pokerogue/src/ui/ui-handler.ts
Flashfyre 70d61700d0 Re-implement UI reskin with working legacy toggle
Re-implement UI reskin with working legacy toggle; add return to title option to menu
2024-03-31 21:14:35 -04:00

49 lines
991 B
TypeScript

import BattleScene, { Button } from "../battle-scene";
import { TextStyle, getTextColor } from "./text";
import UI, { Mode } from "./ui";
export default abstract class UiHandler {
protected scene: BattleScene;
protected mode: integer;
protected cursor: integer = 0;
public active: boolean = false;
constructor(scene: BattleScene, mode: Mode) {
this.scene = scene;
this.mode = mode;
}
abstract setup(): void;
show(_args: any[]): boolean {
this.active = true;
return true;
}
abstract processInput(button: Button): boolean;
getUi() {
return this.scene.ui;
}
getTextColor(style: TextStyle, shadow: boolean = false): string {
return getTextColor(style, shadow, this.scene.uiTheme);
}
getCursor(): integer {
return this.cursor;
}
setCursor(cursor: integer): boolean {
const changed = this.cursor !== cursor;
if (changed)
this.cursor = cursor;
return changed;
}
clear() {
this.active = false;
}
}