Add evolution cancelling

This commit is contained in:
Flashfyre committed 2023-12-14 11:54:56 -05:00
1 parent 01a5fe18dd
commit 1a4d51d060
4 files changed
+120 -60

No files matched your search

+15 -1
View File
@@ -4,23 +4,35 @@ import UiHandler from "./uiHandler";
export default class EvolutionSceneHandler extends UiHandler {
public evolutionContainer: Phaser.GameObjects.Container;
public canCancel: boolean;
public cancelled: boolean;
private cleanupFunc: Function;
constructor(scene: BattleScene) {
super(scene, Mode.EVOLUTION_SCENE);
}
setup() {
this.canCancel = false;
this.cancelled = false;
this.evolutionContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
this.scene.fieldUI.add(this.evolutionContainer);
}
show(_args: any[]): void {
super.show(_args);
this.scene.fieldUI.bringToTop(this.evolutionContainer);
}
processInput(button: Button): boolean {
if (this.canCancel && !this.cancelled && button === Button.CANCEL) {
this.cancelled = true;
return true;
}
return this.scene.ui.getMessageHandler().processInput(button);
}
@@ -29,6 +41,8 @@ export default class EvolutionSceneHandler extends UiHandler {
}
clear() {
this.canCancel = false;
this.cancelled = false;
this.evolutionContainer.removeAll(true);
}
}