Adding the ability to set the player's color outline via the scripting API

(currently not shared with the other players yet)
This commit is contained in:
David Négrier 2021-12-21 17:02:18 +01:00
parent e086f6dac0
commit 90f7287860
11 changed files with 282 additions and 9 deletions

View file

@ -1300,6 +1300,18 @@ ${escapedMessage}
iframeListener.registerAnswerer("removeActionMessage", (message) => {
layoutManagerActionStore.removeAction(message.uuid);
});
iframeListener.registerAnswerer("setPlayerOutline", (message) => {
const normalizeColor = (color: number) => Math.min(Math.max(0, Math.round(color)), 255);
const red = normalizeColor(message.red);
const green = normalizeColor(message.green);
const blue = normalizeColor(message.blue);
this.CurrentPlayer.setOutlineColor(red, green, blue);
});
iframeListener.registerAnswerer("removePlayerOutline", (message) => {
this.CurrentPlayer.removeOutlineColor();
});
}
private setPropertyLayer(
@ -1422,6 +1434,7 @@ ${escapedMessage}
iframeListener.unregisterAnswerer("removeActionMessage");
iframeListener.unregisterAnswerer("openCoWebsite");
iframeListener.unregisterAnswerer("getCoWebsites");
iframeListener.unregisterAnswerer("setPlayerOutline");
this.sharedVariablesManager?.close();
this.embeddedWebsiteManager?.close();