mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Breaking up processInput()
This commit is contained in:
parent
85b92bffed
commit
9addf5cd0a
@ -709,18 +709,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
return filterResult;
|
||||
}
|
||||
|
||||
processOptionMenuInput(button: Button) {
|
||||
processActionButtonForOptions(option: PartyOption) {
|
||||
const ui = this.getUi();
|
||||
const option = this.options[this.optionsCursor];
|
||||
|
||||
// Button.CANCEL has no special behavior for any option
|
||||
if (button === Button.CANCEL) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (button === Button.ACTION) {
|
||||
if (option === PartyOption.CANCEL) {
|
||||
return this.processOptionMenuInput(Button.CANCEL);
|
||||
}
|
||||
@ -855,6 +845,21 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
processOptionMenuInput(button: Button) {
|
||||
const ui = this.getUi();
|
||||
const option = this.options[this.optionsCursor];
|
||||
|
||||
// Button.CANCEL has no special behavior for any option
|
||||
if (button === Button.CANCEL) {
|
||||
this.clearOptions();
|
||||
ui.playSelect();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (button === Button.ACTION) {
|
||||
return this.processActionButtonForOptions(option);
|
||||
}
|
||||
|
||||
if (button === Button.UP || button === Button.DOWN) {
|
||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
|
||||
return this.processModifierTransferModeUpDownInput(button);
|
||||
@ -895,12 +900,32 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
let success = false;
|
||||
|
||||
if (this.optionsMode) {
|
||||
let success = false;
|
||||
success = this.processOptionMenuInput(button);
|
||||
} else {
|
||||
if (success) {
|
||||
ui.playSelect();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
if (button === Button.ACTION) {
|
||||
return this.processPartyActionInput();
|
||||
}
|
||||
|
||||
if (button === Button.CANCEL) {
|
||||
return this.processPartyCancelInput();
|
||||
}
|
||||
|
||||
if (button === Button.UP || button === Button.DOWN || button === Button.RIGHT || button === Button.LEFT) {
|
||||
return this.processPartyDirectionalInput(button);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
processPartyActionInput(): boolean {
|
||||
const ui = this.getUi();
|
||||
if (this.cursor < 6) {
|
||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode) {
|
||||
/** Initialize item quantities for the selected Pokemon */
|
||||
@ -927,7 +952,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (button === Button.CANCEL) {
|
||||
|
||||
processPartyCancelInput(): boolean {
|
||||
const ui = this.getUi();
|
||||
if (
|
||||
(this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) &&
|
||||
this.transferMode
|
||||
@ -945,13 +972,15 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
ui.playSelect();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
processPartyDirectionalInput(button: Button.UP | Button.DOWN | Button.LEFT | Button.RIGHT): boolean {
|
||||
const ui = this.getUi();
|
||||
const slotCount = this.partySlots.length;
|
||||
const battlerCount = globalScene.currentBattle.getBattlerCount();
|
||||
|
||||
let success = false;
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
success = this.setCursor(this.cursor ? (this.cursor < 6 ? this.cursor - 1 : slotCount - 1) : 6);
|
||||
@ -978,12 +1007,10 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
ui.playSelect();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user