blocking inputs while showing texts to prevent moveing cursor

This commit is contained in:
cadi 2024-06-18 18:37:27 +09:00
parent 57e90b8f4b
commit 2d8ba35210

View File

@ -109,6 +109,8 @@ export default class PartyUiHandler extends MessageUiHandler {
private iconAnimHandler: PokemonIconAnimHandler; private iconAnimHandler: PokemonIconAnimHandler;
private blockInput: boolean;
private static FilterAll = (_pokemon: PlayerPokemon) => null; private static FilterAll = (_pokemon: PlayerPokemon) => null;
public static FilterNonFainted = (pokemon: PlayerPokemon) => { public static FilterNonFainted = (pokemon: PlayerPokemon) => {
@ -254,7 +256,7 @@ export default class PartyUiHandler extends MessageUiHandler {
processInput(button: Button): boolean { processInput(button: Button): boolean {
const ui = this.getUi(); const ui = this.getUi();
if (this.pendingPrompt) { if (this.pendingPrompt || this.blockInput) {
return false; return false;
} }
@ -395,7 +397,9 @@ export default class PartyUiHandler extends MessageUiHandler {
this.clearOptions(); this.clearOptions();
ui.playSelect(); ui.playSelect();
if (this.cursor >= this.scene.currentBattle.getBattlerCount() || !pokemon.isAllowedInBattle()) { if (this.cursor >= this.scene.currentBattle.getBattlerCount() || !pokemon.isAllowedInBattle()) {
this.blockInput = true;
this.showText(`Do you really want to release ${pokemon.name}?`, null, () => { this.showText(`Do you really want to release ${pokemon.name}?`, null, () => {
this.blockInput = false;
ui.setModeWithoutClear(Mode.CONFIRM, () => { ui.setModeWithoutClear(Mode.CONFIRM, () => {
ui.setMode(Mode.PARTY); ui.setMode(Mode.PARTY);
this.doRelease(this.cursor); this.doRelease(this.cursor);