From 91f299ba827ba984c939b14f9c857fafd8e1a8b5 Mon Sep 17 00:00:00 2001 From: Piotr 'pwh' Hanusiak Date: Thu, 14 Apr 2022 12:37:31 +0200 Subject: [PATCH] change status when entering silent zone --- front/src/Phaser/Entity/Character.ts | 1 + front/src/Phaser/Game/GameMapPropertiesListener.ts | 7 +++++-- front/src/Phaser/Game/GameScene.ts | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Entity/Character.ts b/front/src/Phaser/Entity/Character.ts index 10578416..10880f97 100644 --- a/front/src/Phaser/Entity/Character.ts +++ b/front/src/Phaser/Entity/Character.ts @@ -356,6 +356,7 @@ export abstract class Character extends Container implements OutlineableInterfac super.destroy(); } + // TODO: Remove silent store and check for status? isSilent() { isSilentStore.set(true); } diff --git a/front/src/Phaser/Game/GameMapPropertiesListener.ts b/front/src/Phaser/Game/GameMapPropertiesListener.ts index 8ffefefc..aa1218e6 100644 --- a/front/src/Phaser/Game/GameMapPropertiesListener.ts +++ b/front/src/Phaser/Game/GameMapPropertiesListener.ts @@ -17,6 +17,7 @@ import { audioManagerFileStore, audioManagerVisibilityStore } from "../../Stores import { iframeListener } from "../../Api/IframeListener"; import { Room } from "../../Connexion/Room"; import LL from "../../i18n/i18n-svelte"; +import { AvailabilityStatus } from "../../Messages/ts-proto-generated/protos/messages"; interface OpenCoWebsite { actionId: string; @@ -144,10 +145,12 @@ export class GameMapPropertiesListener { this.gameMap.onPropertyChange(GameMapProperties.SILENT, (newValue) => { if (newValue === undefined || newValue === false || newValue === "") { - // this.scene.connection?.setSilent(false); + this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.ONLINE); + this.scene.CurrentPlayer.setStatus(AvailabilityStatus.ONLINE); this.scene.CurrentPlayer.noSilent(); } else { - // this.scene.connection?.setSilent(true); + this.scene.connection?.emitPlayerStatusChange(AvailabilityStatus.SILENT); + this.scene.CurrentPlayer.setStatus(AvailabilityStatus.SILENT); this.scene.CurrentPlayer.isSilent(); } }); diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 84812a49..bdc09f81 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -2109,6 +2109,7 @@ ${escapedMessage} character.showTalkIcon(message.details?.showVoiceIndicator); } if (message.details?.status !== undefined) { + console.log(message.details); character.setStatus(message.details?.status); } }