mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 16:32: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;
|
return filterResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
processOptionMenuInput(button: Button) {
|
processActionButtonForOptions(option: PartyOption) {
|
||||||
const ui = this.getUi();
|
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) {
|
if (option === PartyOption.CANCEL) {
|
||||||
return this.processOptionMenuInput(Button.CANCEL);
|
return this.processOptionMenuInput(Button.CANCEL);
|
||||||
}
|
}
|
||||||
@ -855,6 +845,21 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
return true;
|
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 (button === Button.UP || button === Button.DOWN) {
|
||||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
|
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER) {
|
||||||
return this.processModifierTransferModeUpDownInput(button);
|
return this.processModifierTransferModeUpDownInput(button);
|
||||||
@ -895,12 +900,32 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let success = false;
|
|
||||||
|
|
||||||
if (this.optionsMode) {
|
if (this.optionsMode) {
|
||||||
|
let success = false;
|
||||||
success = this.processOptionMenuInput(button);
|
success = this.processOptionMenuInput(button);
|
||||||
} else {
|
if (success) {
|
||||||
|
ui.playSelect();
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
if (button === Button.ACTION) {
|
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.cursor < 6) {
|
||||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode) {
|
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode) {
|
||||||
/** Initialize item quantities for the selected Pokemon */
|
/** Initialize item quantities for the selected Pokemon */
|
||||||
@ -927,7 +952,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (button === Button.CANCEL) {
|
|
||||||
|
processPartyCancelInput(): boolean {
|
||||||
|
const ui = this.getUi();
|
||||||
if (
|
if (
|
||||||
(this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) &&
|
(this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) &&
|
||||||
this.transferMode
|
this.transferMode
|
||||||
@ -945,13 +972,15 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processPartyDirectionalInput(button: Button.UP | Button.DOWN | Button.LEFT | Button.RIGHT): boolean {
|
||||||
|
const ui = this.getUi();
|
||||||
const slotCount = this.partySlots.length;
|
const slotCount = this.partySlots.length;
|
||||||
const battlerCount = globalScene.currentBattle.getBattlerCount();
|
const battlerCount = globalScene.currentBattle.getBattlerCount();
|
||||||
|
|
||||||
|
let success = false;
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.UP:
|
case Button.UP:
|
||||||
success = this.setCursor(this.cursor ? (this.cursor < 6 ? this.cursor - 1 : slotCount - 1) : 6);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user