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

View File

@ -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;

View File

@ -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<string>): void {

View File

@ -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;