pokerogue/src/ui/awaitable-ui-handler.ts
2024-02-14 10:44:55 -05:00

26 lines
775 B
TypeScript

import BattleScene, { Button } from "../battle-scene";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
export default abstract class AwaitableUiHandler extends UiHandler {
protected awaitingActionInput: boolean;
protected onActionInput: Function;
public tutorialActive: boolean = false;
constructor(scene: BattleScene, mode: Mode) {
super(scene, mode);
}
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;
}
}