renamed buttons to LB & RB + added whitelist for these buttons to specific handler
parent
bb28d3599e
commit
22c81f1a80
|
@ -8,8 +8,8 @@ export enum Button {
|
||||||
CANCEL,
|
CANCEL,
|
||||||
MENU,
|
MENU,
|
||||||
STATS,
|
STATS,
|
||||||
CYCLE_SHINY,
|
RB, // CYCLE_SHINY
|
||||||
CYCLE_FORM,
|
LB, // CYCLE_FORM
|
||||||
CYCLE_GENDER,
|
CYCLE_GENDER,
|
||||||
CYCLE_ABILITY,
|
CYCLE_ABILITY,
|
||||||
CYCLE_NATURE,
|
CYCLE_NATURE,
|
||||||
|
|
|
@ -130,8 +130,8 @@ export class InputsController {
|
||||||
gamepadMapping[this.player.mapping.RC_E] = this.scene.abSwapped ? Button.ACTION : Button.CANCEL;
|
gamepadMapping[this.player.mapping.RC_E] = this.scene.abSwapped ? Button.ACTION : Button.CANCEL;
|
||||||
gamepadMapping[this.player.mapping.SELECT] = Button.STATS;
|
gamepadMapping[this.player.mapping.SELECT] = Button.STATS;
|
||||||
gamepadMapping[this.player.mapping.START] = Button.MENU;
|
gamepadMapping[this.player.mapping.START] = Button.MENU;
|
||||||
gamepadMapping[this.player.mapping.RB] = Button.CYCLE_SHINY;
|
gamepadMapping[this.player.mapping.RB] = Button.RB;
|
||||||
gamepadMapping[this.player.mapping.LB] = Button.CYCLE_FORM;
|
gamepadMapping[this.player.mapping.LB] = Button.LB;
|
||||||
gamepadMapping[this.player.mapping.LT] = Button.CYCLE_GENDER;
|
gamepadMapping[this.player.mapping.LT] = Button.CYCLE_GENDER;
|
||||||
gamepadMapping[this.player.mapping.RT] = Button.CYCLE_ABILITY;
|
gamepadMapping[this.player.mapping.RT] = Button.CYCLE_ABILITY;
|
||||||
gamepadMapping[this.player.mapping.RC_W] = Button.CYCLE_NATURE;
|
gamepadMapping[this.player.mapping.RC_W] = Button.CYCLE_NATURE;
|
||||||
|
@ -180,8 +180,8 @@ export class InputsController {
|
||||||
[Button.CANCEL]: [keyCodes.BACKSPACE, keyCodes.X],
|
[Button.CANCEL]: [keyCodes.BACKSPACE, keyCodes.X],
|
||||||
[Button.MENU]: [keyCodes.ESC, keyCodes.M],
|
[Button.MENU]: [keyCodes.ESC, keyCodes.M],
|
||||||
[Button.STATS]: [keyCodes.SHIFT, keyCodes.C],
|
[Button.STATS]: [keyCodes.SHIFT, keyCodes.C],
|
||||||
[Button.CYCLE_SHINY]: [keyCodes.R],
|
[Button.RB]: [keyCodes.R],
|
||||||
[Button.CYCLE_FORM]: [keyCodes.F],
|
[Button.LB]: [keyCodes.F],
|
||||||
[Button.CYCLE_GENDER]: [keyCodes.G],
|
[Button.CYCLE_GENDER]: [keyCodes.G],
|
||||||
[Button.CYCLE_ABILITY]: [keyCodes.E],
|
[Button.CYCLE_ABILITY]: [keyCodes.E],
|
||||||
[Button.CYCLE_NATURE]: [keyCodes.N],
|
[Button.CYCLE_NATURE]: [keyCodes.N],
|
||||||
|
|
|
@ -57,8 +57,8 @@ export class UiInputs {
|
||||||
actions[Button.CANCEL] = () => this.buttonAb(Button.CANCEL);
|
actions[Button.CANCEL] = () => this.buttonAb(Button.CANCEL);
|
||||||
actions[Button.MENU] = () => this.buttonMenu();
|
actions[Button.MENU] = () => this.buttonMenu();
|
||||||
actions[Button.STATS] = () => this.buttonStats(true);
|
actions[Button.STATS] = () => this.buttonStats(true);
|
||||||
actions[Button.CYCLE_SHINY] = () => this.buttonCycleOption(Button.CYCLE_SHINY);
|
actions[Button.RB] = () => this.buttonCycleOption(Button.RB);
|
||||||
actions[Button.CYCLE_FORM] = () => this.buttonCycleOption(Button.CYCLE_FORM);
|
actions[Button.LB] = () => this.buttonCycleOption(Button.LB);
|
||||||
actions[Button.CYCLE_GENDER] = () => this.buttonCycleOption(Button.CYCLE_GENDER);
|
actions[Button.CYCLE_GENDER] = () => this.buttonCycleOption(Button.CYCLE_GENDER);
|
||||||
actions[Button.CYCLE_ABILITY] = () => this.buttonCycleOption(Button.CYCLE_ABILITY);
|
actions[Button.CYCLE_ABILITY] = () => this.buttonCycleOption(Button.CYCLE_ABILITY);
|
||||||
actions[Button.CYCLE_NATURE] = () => this.buttonCycleOption(Button.CYCLE_NATURE);
|
actions[Button.CYCLE_NATURE] = () => this.buttonCycleOption(Button.CYCLE_NATURE);
|
||||||
|
@ -130,7 +130,9 @@ export class UiInputs {
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonCycleOption(button: Button): void {
|
buttonCycleOption(button: Button): void {
|
||||||
if (this.scene.ui?.getHandler() instanceof StarterSelectUiHandler) {
|
const whitelist = [StarterSelectUiHandler, SettingsUiHandler];
|
||||||
|
const uiHandler = this.scene.ui?.getHandler();
|
||||||
|
if (whitelist.some(handler => uiHandler instanceof handler)) {
|
||||||
this.scene.ui.processInput(button);
|
this.scene.ui.processInput(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,12 @@ export default class SettingsUiHandler extends UiHandler {
|
||||||
if (this.optionCursors[cursor] < this.optionValueLabels[cursor].length - 1)
|
if (this.optionCursors[cursor] < this.optionValueLabels[cursor].length - 1)
|
||||||
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
|
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
|
||||||
break;
|
break;
|
||||||
|
case Button.LB:
|
||||||
|
console.log('lb');
|
||||||
|
break;
|
||||||
|
case Button.RB:
|
||||||
|
console.log('rb');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -969,7 +969,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
const row = Math.floor(this.cursor / 9);
|
const row = Math.floor(this.cursor / 9);
|
||||||
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
|
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.CYCLE_SHINY:
|
case Button.RB:
|
||||||
if (this.canCycleShiny) {
|
if (this.canCycleShiny) {
|
||||||
this.setSpeciesDetails(this.lastSpecies, !props.shiny, undefined, undefined, props.shiny ? 0 : undefined, undefined, undefined);
|
this.setSpeciesDetails(this.lastSpecies, !props.shiny, undefined, undefined, props.shiny ? 0 : undefined, undefined, undefined);
|
||||||
if (this.dexAttrCursor & DexAttr.SHINY)
|
if (this.dexAttrCursor & DexAttr.SHINY)
|
||||||
|
@ -978,7 +978,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.CYCLE_FORM:
|
case Button.LB:
|
||||||
if (this.canCycleForm) {
|
if (this.canCycleForm) {
|
||||||
const formCount = this.lastSpecies.forms.length;
|
const formCount = this.lastSpecies.forms.length;
|
||||||
let newFormIndex = props.formIndex;
|
let newFormIndex = props.formIndex;
|
||||||
|
|
Loading…
Reference in New Issue