mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Splitting process input for menu into its own function
This commit is contained in:
parent
718c8cfbb9
commit
c16f39b063
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user