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);
}
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;