diff --git a/front/src/Phaser/Components/TalkIcon.ts b/front/src/Phaser/Components/TalkIcon.ts index 78e9379f..12b4ebe3 100644 --- a/front/src/Phaser/Components/TalkIcon.ts +++ b/front/src/Phaser/Components/TalkIcon.ts @@ -20,15 +20,17 @@ export class TalkIcon extends Phaser.GameObjects.Image { this.scene.add.existing(this); } - public show(show: boolean = true): void { - if (this.shown === show) { + public show(show: boolean = true, forceClose: boolean = false): void { + if (this.shown === show && !forceClose) { return; } - this.showAnimation(show); + this.showAnimation(show, forceClose); } - private showAnimation(show: boolean = true) { - if (this.showAnimationTween?.isPlaying()) { + private showAnimation(show: boolean = true, forceClose: boolean = false) { + if (forceClose && !show) { + this.showAnimationTween?.stop(); + } else if (this.showAnimationTween?.isPlaying()) { return; } this.shown = show; diff --git a/front/src/Phaser/Entity/Character.ts b/front/src/Phaser/Entity/Character.ts index 3987c889..00067897 100644 --- a/front/src/Phaser/Entity/Character.ts +++ b/front/src/Phaser/Entity/Character.ts @@ -213,8 +213,8 @@ export abstract class Character extends Container implements OutlineableInterfac }); } - public showTalkIcon(show: boolean = true): void { - this.talkIcon.show(show); + public showTalkIcon(show: boolean = true, forceClose: boolean = false): void { + this.talkIcon.show(show, forceClose); } public addCompanion(name: string, texturePromise?: CancelablePromise): void { diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 9dcc4063..c377b20b 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -678,8 +678,8 @@ export class GameScene extends DirtyScene { }); } } else { - this.CurrentPlayer.showTalkIcon(false); - this.MapPlayersByKey.forEach((remotePlayer) => remotePlayer.showTalkIcon(false)); + this.CurrentPlayer.showTalkIcon(false, true); + this.MapPlayersByKey.forEach((remotePlayer) => remotePlayer.showTalkIcon(false, true)); if (this.localVolumeStoreUnsubscriber) { this.localVolumeStoreUnsubscriber(); this.localVolumeStoreUnsubscriber = undefined;