mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-26 11:38:54 +00:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
81 lines
1.6 KiB
TypeScript
81 lines
1.6 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import * as Utils from "../utils";
|
|
|
|
export default class SavingIconHandler extends Phaser.GameObjects.Container {
|
|
private icon: Phaser.GameObjects.Sprite;
|
|
|
|
private animActive: boolean;
|
|
private shown: boolean;
|
|
|
|
constructor() {
|
|
super(globalScene, globalScene.game.canvas.width / 6 - 4, globalScene.game.canvas.height / 6 - 4);
|
|
}
|
|
|
|
setup(): void {
|
|
this.icon = globalScene.add.sprite(0, 0, "saving_icon");
|
|
this.icon.setOrigin(1, 1);
|
|
|
|
this.add(this.icon);
|
|
|
|
this.animActive = false;
|
|
this.shown = false;
|
|
|
|
this.setAlpha(0);
|
|
this.setVisible(false);
|
|
}
|
|
|
|
show(): void {
|
|
this.shown = true;
|
|
|
|
if (this.animActive) {
|
|
return;
|
|
}
|
|
|
|
this.animActive = true;
|
|
|
|
globalScene.tweens.add({
|
|
targets: this,
|
|
alpha: 1,
|
|
duration: Utils.fixedInt(250),
|
|
ease: "Sine.easeInOut",
|
|
onComplete: () => {
|
|
globalScene.time.delayedCall(Utils.fixedInt(500), () => {
|
|
this.animActive = false;
|
|
if (!this.shown) {
|
|
this.hide();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
this.setVisible(true);
|
|
this.shown = true;
|
|
}
|
|
|
|
hide(): void {
|
|
this.shown = false;
|
|
|
|
if (this.animActive) {
|
|
return;
|
|
}
|
|
|
|
this.animActive = true;
|
|
|
|
globalScene.tweens.add({
|
|
targets: this,
|
|
alpha: 0,
|
|
duration: Utils.fixedInt(250),
|
|
ease: "Sine.easeInOut",
|
|
onComplete: () => {
|
|
this.animActive = false;
|
|
this.setVisible(false);
|
|
if (this.shown) {
|
|
this.show();
|
|
}
|
|
}
|
|
});
|
|
|
|
this.shown = false;
|
|
}
|
|
}
|