forcing close talkIcon indicator when leaving bubble conversation

This commit is contained in:
Hanusiak Piotr
2022-02-16 15:55:07 +01:00
parent 0b0d3b5beb
commit e590cee753
3 changed files with 11 additions and 9 deletions
+7 -5
View File
@@ -20,15 +20,17 @@ export class TalkIcon extends Phaser.GameObjects.Image {
this.scene.add.existing(this); this.scene.add.existing(this);
} }
public show(show: boolean = true): void { public show(show: boolean = true, forceClose: boolean = false): void {
if (this.shown === show) { if (this.shown === show && !forceClose) {
return; return;
} }
this.showAnimation(show); this.showAnimation(show, forceClose);
} }
private showAnimation(show: boolean = true) { private showAnimation(show: boolean = true, forceClose: boolean = false) {
if (this.showAnimationTween?.isPlaying()) { if (forceClose && !show) {
this.showAnimationTween?.stop();
} else if (this.showAnimationTween?.isPlaying()) {
return; return;
} }
this.shown = show; this.shown = show;
+2 -2
View File
@@ -213,8 +213,8 @@ export abstract class Character extends Container implements OutlineableInterfac
}); });
} }
public showTalkIcon(show: boolean = true): void { public showTalkIcon(show: boolean = true, forceClose: boolean = false): void {
this.talkIcon.show(show); this.talkIcon.show(show, forceClose);
} }
public addCompanion(name: string, texturePromise?: CancelablePromise<string>): void { public addCompanion(name: string, texturePromise?: CancelablePromise<string>): void {
+2 -2
View File
@@ -678,8 +678,8 @@ export class GameScene extends DirtyScene {
}); });
} }
} else { } else {
this.CurrentPlayer.showTalkIcon(false); this.CurrentPlayer.showTalkIcon(false, true);
this.MapPlayersByKey.forEach((remotePlayer) => remotePlayer.showTalkIcon(false)); this.MapPlayersByKey.forEach((remotePlayer) => remotePlayer.showTalkIcon(false, true));
if (this.localVolumeStoreUnsubscriber) { if (this.localVolumeStoreUnsubscriber) {
this.localVolumeStoreUnsubscriber(); this.localVolumeStoreUnsubscriber();
this.localVolumeStoreUnsubscriber = undefined; this.localVolumeStoreUnsubscriber = undefined;