mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processOptionMenuInput(button: Button) {
|
||||||
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;
|
let success = false;
|
||||||
|
const ui = this.getUi();
|
||||||
if (this.optionsMode) {
|
|
||||||
const option = this.options[this.optionsCursor];
|
const option = this.options[this.optionsCursor];
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION) {
|
||||||
const pokemon = globalScene.getPlayerParty()[this.cursor];
|
const pokemon = globalScene.getPlayerParty()[this.cursor];
|
||||||
@ -573,10 +554,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
pokemon.pauseEvolutions = !pokemon.pauseEvolutions;
|
pokemon.pauseEvolutions = !pokemon.pauseEvolutions;
|
||||||
this.showText(
|
this.showText(
|
||||||
i18next.t(
|
i18next.t(pokemon.pauseEvolutions ? "partyUiHandler:pausedEvolutions" : "partyUiHandler:unpausedEvolutions", {
|
||||||
pokemon.pauseEvolutions ? "partyUiHandler:pausedEvolutions" : "partyUiHandler:unpausedEvolutions",
|
pokemonName: getPokemonNameWithAffix(pokemon, false),
|
||||||
{ pokemonName: getPokemonNameWithAffix(pokemon, false) },
|
}),
|
||||||
),
|
|
||||||
undefined,
|
undefined,
|
||||||
() => this.showText("", 0),
|
() => this.showText("", 0),
|
||||||
null,
|
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 {
|
} else {
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION) {
|
||||||
if (this.cursor < 6) {
|
if (this.cursor < 6) {
|
||||||
|
Loading…
Reference in New Issue
Block a user