pokerogue/src/ui/awaitable-ui-handler.ts

26 lines
775 B
TypeScript
Raw Normal View History

2024-02-14 15:44:55 +00:00
import BattleScene, { Button } from "../battle-scene";
2023-03-28 19:54:52 +01:00
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
2023-03-28 19:54:52 +01:00
export default abstract class AwaitableUiHandler extends UiHandler {
protected awaitingActionInput: boolean;
protected onActionInput: Function;
2024-02-14 15:44:55 +00:00
public tutorialActive: boolean = false;
2023-03-28 19:54:52 +01:00
constructor(scene: BattleScene, mode: Mode) {
super(scene, mode);
}
2024-02-14 15:44:55 +00:00
processTutorialInput(button: Button): boolean {
if ((button === Button.ACTION || button === Button.CANCEL) && this.onActionInput) {
this.getUi().playSelect();
const originalOnActionInput = this.onActionInput;
this.onActionInput = null;
originalOnActionInput();
this.awaitingActionInput = false;
return true;
}
return false;
}
2023-03-28 19:54:52 +01:00
}