From a41133a55a60d84d73faca460d9b9ec8e57ce448 Mon Sep 17 00:00:00 2001 From: cadi Date: Mon, 2 Sep 2024 07:26:45 +0900 Subject: [PATCH] blocking inputs while showing texts to prevent moveing cursor (#2371) Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/ui/party-ui-handler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index e7c4069c16e..a61037548e6 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -166,6 +166,8 @@ export default class PartyUiHandler extends MessageUiHandler { private iconAnimHandler: PokemonIconAnimHandler; + private blockInput: boolean; + private static FilterAll = (_pokemon: PlayerPokemon) => null; public static FilterNonFainted = (pokemon: PlayerPokemon) => { @@ -317,7 +319,7 @@ export default class PartyUiHandler extends MessageUiHandler { processInput(button: Button): boolean { const ui = this.getUi(); - if (this.pendingPrompt) { + if (this.pendingPrompt || this.blockInput) { return false; } @@ -485,7 +487,9 @@ export default class PartyUiHandler extends MessageUiHandler { this.clearOptions(); ui.playSelect(); if (this.cursor >= this.scene.currentBattle.getBattlerCount() || !pokemon.isAllowedInBattle()) { + this.blockInput = true; this.showText(i18next.t("partyUiHandler:releaseConfirmation", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => { + this.blockInput = false; ui.setModeWithoutClear(Mode.CONFIRM, () => { ui.setMode(Mode.PARTY); this.doRelease(this.cursor);