Splitting process input for menu into its own function

This commit is contained in:
Wlowscha 2025-05-12 22:52:28 +02:00
parent 718c8cfbb9
commit c16f39b063
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -355,28 +355,9 @@ export default class PartyUiHandler extends MessageUiHandler {
return true;
}
processInput(button: Button): boolean {
const ui = this.getUi();
if (this.pendingPrompt || this.blockInput) {
return false;
}
if (this.awaitingActionInput) {
if ((button === Button.ACTION || button === Button.CANCEL) && this.onActionInput) {
ui.playSelect();
const originalOnActionInput = this.onActionInput;
this.onActionInput = null;
originalOnActionInput();
this.awaitingActionInput = false;
return true;
}
return false;
}
processOptionMenuInput(button: Button) {
let success = false;
if (this.optionsMode) {
const ui = this.getUi();
const option = this.options[this.optionsCursor];
if (button === Button.ACTION) {
const pokemon = globalScene.getPlayerParty()[this.cursor];
@ -573,10 +554,9 @@ export default class PartyUiHandler extends MessageUiHandler {
ui.playSelect();
pokemon.pauseEvolutions = !pokemon.pauseEvolutions;
this.showText(
i18next.t(
pokemon.pauseEvolutions ? "partyUiHandler:pausedEvolutions" : "partyUiHandler:unpausedEvolutions",
{ pokemonName: getPokemonNameWithAffix(pokemon, false) },
),
i18next.t(pokemon.pauseEvolutions ? "partyUiHandler:pausedEvolutions" : "partyUiHandler:unpausedEvolutions", {
pokemonName: getPokemonNameWithAffix(pokemon, false),
}),
undefined,
() => this.showText("", 0),
null,
@ -751,6 +731,33 @@ export default class PartyUiHandler extends MessageUiHandler {
}
}
}
return success;
}
processInput(button: Button): boolean {
const ui = this.getUi();
if (this.pendingPrompt || this.blockInput) {
return false;
}
if (this.awaitingActionInput) {
if ((button === Button.ACTION || button === Button.CANCEL) && this.onActionInput) {
ui.playSelect();
const originalOnActionInput = this.onActionInput;
this.onActionInput = null;
originalOnActionInput();
this.awaitingActionInput = false;
return true;
}
return false;
}
let success = false;
if (this.optionsMode) {
success = this.processOptionMenuInput(button);
} else {
if (button === Button.ACTION) {
if (this.cursor < 6) {