From 61c68b0875c2fb31cbef07c11dc6713080a0eac8 Mon Sep 17 00:00:00 2001 From: Piotr 'pwh' Hanusiak Date: Thu, 14 Apr 2022 14:31:31 +0200 Subject: [PATCH] silent indicator when on jitsi zone --- .../src/Phaser/Components/PlayerStatusDot.ts | 28 ++++--------------- front/src/Phaser/Game/GameScene.ts | 10 ++++--- maps/tests/status_indicator.json | 20 ++++++++++++- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/front/src/Phaser/Components/PlayerStatusDot.ts b/front/src/Phaser/Components/PlayerStatusDot.ts index 168a1b48..1de553d6 100644 --- a/front/src/Phaser/Components/PlayerStatusDot.ts +++ b/front/src/Phaser/Components/PlayerStatusDot.ts @@ -7,14 +7,11 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container { private status: AvailabilityStatus; - private readonly COLORS = { - online: 0x8cc43f, - onlineOutline: 0x427a25, - away: 0xf5931e, - awayOutline: 0x875d13, - silenced: 0xe74c3c, - silencedOutline: 0xc0392b, - never: 0xff00ff, + private readonly COLORS: Record = { + [AvailabilityStatus.AWAY]: { filling: 0xf5931e, outline: 0x875d13 }, + [AvailabilityStatus.ONLINE]: { filling: 0x8cc43f, outline: 0x427a25 }, + [AvailabilityStatus.SILENT]: { filling: 0xe74c3c, outline: 0xc0392b }, + [AvailabilityStatus.UNRECOGNIZED]: { filling: 0xffffff, outline: 0xffffff }, }; constructor(scene: Phaser.Scene, x: number, y: number) { @@ -62,21 +59,8 @@ export class PlayerStatusDot extends Phaser.GameObjects.Container { } private redraw(): void { - const colors = this.getColors(); + const colors = this.COLORS[this.status]; this.statusImage.setTintFill(colors.filling); this.statusImageOutline.setTintFill(colors.outline); } - - private getColors(): { filling: number; outline: number } { - switch (this.status) { - case AvailabilityStatus.ONLINE: - return { filling: this.COLORS.online, outline: this.COLORS.onlineOutline }; - case AvailabilityStatus.AWAY: - return { filling: this.COLORS.away, outline: this.COLORS.awayOutline }; - case AvailabilityStatus.SILENT: - return { filling: this.COLORS.silenced, outline: this.COLORS.silencedOutline }; - default: - return { filling: this.COLORS.never, outline: this.COLORS.never }; - } - } } diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index bdc09f81..37ab1f04 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -2109,7 +2109,6 @@ ${escapedMessage} character.showTalkIcon(message.details?.showVoiceIndicator); } if (message.details?.status !== undefined) { - console.log(message.details); character.setStatus(message.details?.status); } } @@ -2154,13 +2153,16 @@ ${escapedMessage} } public enableMediaBehaviors() { - // const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT); - // this.connection?.setSilent(!!silent); + const silent = this.gameMap.getCurrentProperties().get(GameMapProperties.SILENT); + const status = silent ? AvailabilityStatus.SILENT : AvailabilityStatus.ONLINE; + this.connection?.emitPlayerStatusChange(status); + this.CurrentPlayer.setStatus(status); mediaManager.showMyCamera(); } public disableMediaBehaviors() { - // this.connection?.setSilent(true); + this.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT); + this.CurrentPlayer.setStatus(AvailabilityStatus.SILENT); mediaManager.hideMyCamera(); } diff --git a/maps/tests/status_indicator.json b/maps/tests/status_indicator.json index deb82e8d..75214d3b 100644 --- a/maps/tests/status_indicator.json +++ b/maps/tests/status_indicator.json @@ -2,6 +2,24 @@ "height":17, "infinite":false, "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 454, 454, 454, 454, 454, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":17, + "id":40, + "name":"jitsiLayer", + "opacity":1, + "properties":[ + { + "name":"jitsiRoom", + "type":"string", + "value":"meeting" + }], + "type":"tilelayer", + "visible":true, + "width":31, + "x":0, + "y":0 + }, { "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 445, 445, 445, 445, 445, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 445, 445, 445, 445, 445, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 445, 445, 445, 445, 445, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 445, 445, 445, 445, 445, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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