2023-04-10 21:24:55 -07:00
|
|
|
import BattleScene, { Button } from "../battle-scene";
|
2023-05-31 16:54:57 -07:00
|
|
|
import OptionSelectUiHandler from "./option-select-ui-handler";
|
2023-04-20 12:46:05 -07:00
|
|
|
import { addTextObject, TextStyle } from "./text";
|
2023-04-06 19:24:13 -07:00
|
|
|
import { Mode } from "./ui";
|
|
|
|
|
2023-05-31 16:54:57 -07:00
|
|
|
export default class ConfirmUiHandler extends OptionSelectUiHandler {
|
2023-04-06 19:24:13 -07:00
|
|
|
private switchCheck: boolean;
|
|
|
|
private switchCheckCursor: integer;
|
|
|
|
|
|
|
|
constructor(scene: BattleScene) {
|
|
|
|
super(scene, Mode.CONFIRM);
|
|
|
|
}
|
|
|
|
|
2023-05-31 16:54:57 -07:00
|
|
|
getWindowName(): string {
|
|
|
|
return 'boolean_window';
|
|
|
|
}
|
2023-04-06 19:24:13 -07:00
|
|
|
|
2023-05-31 16:54:57 -07:00
|
|
|
getWindowWidth(): integer {
|
|
|
|
return 48;
|
|
|
|
}
|
2023-04-06 19:24:13 -07:00
|
|
|
|
2023-05-31 16:54:57 -07:00
|
|
|
getOptions(): string[] {
|
|
|
|
return [ 'Yes', 'No' ];
|
2023-04-06 19:24:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
show(args: any[]) {
|
|
|
|
if (args.length >= 2 && args[0] instanceof Function && args[1] instanceof Function) {
|
|
|
|
super.show(args);
|
|
|
|
|
|
|
|
this.switchCheck = args.length >= 3 && args[2] as boolean;
|
|
|
|
|
|
|
|
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setCursor(cursor: integer): boolean {
|
|
|
|
const ret = super.setCursor(cursor);
|
|
|
|
|
|
|
|
if (ret && this.switchCheck)
|
|
|
|
this.switchCheckCursor = this.cursor;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|