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

28 lines
799 B
TypeScript
Raw Normal View History

import BattleScene from "../battle-scene";
2023-03-28 19:54:52 +01:00
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import {Button} from "#enums/buttons";
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;
}
2024-05-24 00:45:04 +01:00
2024-02-14 15:44:55 +00:00
return false;
}
}