Add retry option (easy mode)

This commit is contained in:
Flashfyre committed 2024-04-04 15:22:05 -04:00
1 parent 23a8fb1fc9
commit 326918a5f1
6 files changed
+75 -7

No files matched your search

@@ -3,12 +3,14 @@ import { TextStyle, addTextObject } from "./text";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
export interface OptionSelectConfig {
xOffset?: number;
yOffset?: number;
options: OptionSelectItem[];
maxOptions?: integer;
delay?: integer;
noCancel?: boolean;
}
@@ -29,6 +31,8 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
protected config: OptionSelectConfig;
protected blockInput: boolean;
protected scrollCursor: integer = 0;
private cursorObj: Phaser.GameObjects.Image;
@@ -93,10 +97,22 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
this.scrollCursor = 0;
this.setCursor(0);
if (this.config.delay) {
this.blockInput = true;
this.optionSelectText.setAlpha(0.5);
this.scene.time.delayedCall(Utils.fixedInt(this.config.delay), () => {
this.blockInput = false;
this.optionSelectText.setAlpha(1);
});
}
return true;
}
processInput(button: Button): boolean {
if (this.blockInput)
return false;
const ui = this.getUi();
let success = false;
+12
View File
@@ -15,6 +15,8 @@ export default class BiomeSelectUiHandler extends UiHandler {
private cursorObj: Phaser.GameObjects.Image;
private blockInput: boolean;
private biomeSelectHandler: Function;
constructor(scene: BattleScene) {
@@ -59,12 +61,22 @@ export default class BiomeSelectUiHandler extends UiHandler {
this.biomeSelectContainer.setVisible(true);
this.setCursor(0);
this.blockInput = true;
this.biomesText.setAlpha(0.5);
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
this.blockInput = false;
this.biomesText.setAlpha(1);
});
}
return true;
}
processInput(button: Button): boolean {
if (this.blockInput)
return false;
const ui = this.getUi();
let success = false;
+2 -1
View File
@@ -26,7 +26,8 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
label: 'No',
handler: args[1]
}
]
],
delay: args.length >= 6 && args[5] !== null ? args[5] as integer : 0
};
super.show([ config ]);