2023-04-11 05:24:55 +01:00
|
|
|
import BattleScene, { Button } from "../battle-scene";
|
2023-04-10 18:54:06 +01:00
|
|
|
import { Mode } from "./ui";
|
|
|
|
import UiHandler from "./uiHandler";
|
|
|
|
|
|
|
|
export default class EvolutionSceneHandler extends UiHandler {
|
|
|
|
public evolutionContainer: Phaser.GameObjects.Container;
|
2023-12-14 16:54:56 +00:00
|
|
|
public canCancel: boolean;
|
|
|
|
public cancelled: boolean;
|
|
|
|
|
2023-04-10 18:54:06 +01:00
|
|
|
constructor(scene: BattleScene) {
|
|
|
|
super(scene, Mode.EVOLUTION_SCENE);
|
|
|
|
}
|
|
|
|
|
|
|
|
setup() {
|
2023-12-14 16:54:56 +00:00
|
|
|
this.canCancel = false;
|
|
|
|
this.cancelled = false;
|
|
|
|
|
2023-04-10 18:54:06 +01:00
|
|
|
this.evolutionContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
|
|
|
|
this.scene.fieldUI.add(this.evolutionContainer);
|
|
|
|
}
|
2023-05-18 16:11:06 +01:00
|
|
|
|
|
|
|
show(_args: any[]): void {
|
|
|
|
super.show(_args);
|
2023-12-14 16:54:56 +00:00
|
|
|
|
2023-05-18 16:11:06 +01:00
|
|
|
this.scene.fieldUI.bringToTop(this.evolutionContainer);
|
|
|
|
}
|
2023-04-10 18:54:06 +01:00
|
|
|
|
2023-11-12 05:31:40 +00:00
|
|
|
processInput(button: Button): boolean {
|
2023-12-14 16:54:56 +00:00
|
|
|
if (this.canCancel && !this.cancelled && button === Button.CANCEL) {
|
|
|
|
this.cancelled = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-11-12 05:31:40 +00:00
|
|
|
return this.scene.ui.getMessageHandler().processInput(button);
|
2023-04-10 18:54:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
setCursor(_cursor: integer): boolean {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
clear() {
|
2023-12-14 16:54:56 +00:00
|
|
|
this.canCancel = false;
|
|
|
|
this.cancelled = false;
|
2023-04-10 18:54:06 +01:00
|
|
|
this.evolutionContainer.removeAll(true);
|
|
|
|
}
|
|
|
|
}
|