adding essential data into config file

pull/685/head
Greenlamp 2024-05-11 02:33:41 +02:00
parent ef4bb9c3b5
commit 022c4351d3
8 changed files with 42 additions and 21 deletions

View File

@ -1,3 +1,6 @@
import {SettingGamepad} from "../system/settings-gamepad";
import {Button} from "#app/enums/buttons";
/**
* Generic pad mapping
*/
@ -20,8 +23,7 @@ const pad_xbox360 = {
LC_N: 12,
LC_S: 13,
LC_W: 14,
LC_E: 15,
MENU: 16
LC_E: 15
},
icons: {
RC_S: "T_X_A_Color_Alt.png",
@ -40,7 +42,26 @@ const pad_xbox360 = {
LC_S: "T_X_Dpad_Down_Alt.png",
LC_W: "T_X_Dpad_Left_Alt.png",
LC_E: "T_X_Dpad_Right_Alt.png",
MENU: ""
},
setting: {
RC_S: SettingGamepad.Button_Action,
RC_E: SettingGamepad.Button_Cancel,
},
default: {
RC_S: Button.ACTION,
RC_E: Button.CANCEL,
RC_W: Button.CYCLE_NATURE,
RC_N: Button.CYCLE_VARIANT,
START: Button.MENU,
SELECT: Button.STATS,
LB: Button.CYCLE_FORM,
RB: Button.CYCLE_SHINY,
LT: Button.CYCLE_GENDER,
RT: Button.CYCLE_ABILITY,
LC_N: Button.UP,
LC_S: Button.DOWN,
LC_W: Button.LEFT,
LC_E: Button.RIGHT,
}
};

View File

@ -8,8 +8,8 @@ export enum Button {
CANCEL,
MENU,
STATS,
RB, // CYCLE_SHINY
LB, // CYCLE_FORM
CYCLE_SHINY, // CYCLE_SHINY
CYCLE_FORM, // CYCLE_FORM
CYCLE_GENDER,
CYCLE_ABILITY,
CYCLE_NATURE,

View File

@ -66,7 +66,6 @@ export class InputsController {
private gamepadSupport: boolean = true;
public customGamepadMapping = new Map();
public chosenGamepad: String;
private disconnectedGamepads: Array<String> = new Array();
@ -287,6 +286,7 @@ export class InputsController {
const mappedPad = this.mapGamepad(gamepadID);
if (!this.player[gamepad]) this.player[gamepad] = {};
this.player[gamepad]['mapping'] = mappedPad.gamepadMapping;
this.player[gamepad]['custom'] = mappedPad.gamepadMapping;
this.player[gamepad]['icons'] = mappedPad.icons;
this.player[gamepad]['type'] = mappedPad.padType;
}
@ -335,8 +335,8 @@ export class InputsController {
gamepadMapping[this.player[this.chosenGamepad].mapping.RC_E] = this.scene.abSwapped ? Button.ACTION : Button.CANCEL;
gamepadMapping[this.player[this.chosenGamepad].mapping.SELECT] = Button.STATS;
gamepadMapping[this.player[this.chosenGamepad].mapping.START] = Button.MENU;
gamepadMapping[this.player[this.chosenGamepad].mapping.RB] = Button.RB;
gamepadMapping[this.player[this.chosenGamepad].mapping.LB] = Button.LB;
gamepadMapping[this.player[this.chosenGamepad].mapping.RB] = Button.CYCLE_SHINY;
gamepadMapping[this.player[this.chosenGamepad].mapping.LB] = Button.CYCLE_FORM;
gamepadMapping[this.player[this.chosenGamepad].mapping.LT] = Button.CYCLE_GENDER;
gamepadMapping[this.player[this.chosenGamepad].mapping.RT] = Button.CYCLE_ABILITY;
gamepadMapping[this.player[this.chosenGamepad].mapping.RC_W] = Button.CYCLE_NATURE;
@ -440,8 +440,8 @@ export class InputsController {
[Button.CANCEL]: [keyCodes.BACKSPACE, keyCodes.X],
[Button.MENU]: [keyCodes.ESC, keyCodes.M],
[Button.STATS]: [keyCodes.SHIFT, keyCodes.C],
[Button.RB]: [keyCodes.R],
[Button.LB]: [keyCodes.F],
[Button.CYCLE_SHINY]: [keyCodes.R],
[Button.CYCLE_FORM]: [keyCodes.F],
[Button.CYCLE_GENDER]: [keyCodes.G],
[Button.CYCLE_ABILITY]: [keyCodes.E],
[Button.CYCLE_NATURE]: [keyCodes.N],

View File

@ -58,8 +58,8 @@ export class UiInputs {
actions[Button.CANCEL] = () => this.buttonAb(Button.CANCEL);
actions[Button.MENU] = () => this.buttonMenu();
actions[Button.STATS] = () => this.buttonStats(true);
actions[Button.RB] = () => this.buttonCycleOption(Button.RB);
actions[Button.LB] = () => this.buttonCycleOption(Button.LB);
actions[Button.CYCLE_SHINY] = () => this.buttonCycleOption(Button.CYCLE_SHINY);
actions[Button.CYCLE_FORM] = () => this.buttonCycleOption(Button.CYCLE_FORM);
actions[Button.CYCLE_GENDER] = () => this.buttonCycleOption(Button.CYCLE_GENDER);
actions[Button.CYCLE_ABILITY] = () => this.buttonCycleOption(Button.CYCLE_ABILITY);
actions[Button.CYCLE_NATURE] = () => this.buttonCycleOption(Button.CYCLE_NATURE);

View File

@ -72,7 +72,7 @@ export default class GamepadBindingUiHandler extends UiHandler {
this.iconDualshock.setOrigin(0.5);
this.iconDualshock.setVisible(false);
this.alreadyAssignedText = addTextObject(this.scene, 0, 0, 'already assigned to', TextStyle.WINDOW);
this.alreadyAssignedText = addTextObject(this.scene, 0, 0, 'will swap with', TextStyle.WINDOW);
this.alreadyAssignedText.setOrigin(0.5);
this.alreadyAssignedText.setPositionRelative(this.optionSelectBg, this.optionSelectBg.width / 2 - 2, this.optionSelectBg.height / 2 - 2);
this.alreadyAssignedText.setVisible(false);
@ -87,9 +87,9 @@ export default class GamepadBindingUiHandler extends UiHandler {
this.cancelLabel.setOrigin(0, 0.5);
this.cancelLabel.setPositionRelative(this.actionBg, 10, this.actionBg.height / 2);
this.actionLabel = addTextObject(this.scene, 0, 0, 'Confirm', TextStyle.SETTINGS_LABEL);
this.actionLabel = addTextObject(this.scene, 0, 0, 'Confirm Swap', TextStyle.SETTINGS_LABEL);
this.actionLabel.setOrigin(0, 0.5);
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 45, this.actionBg.height / 2);
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 75, this.actionBg.height / 2);
this.optionSelectContainer.add(this.iconXbox);

View File

@ -167,10 +167,10 @@ export default class SettingsGamepadUiHandler extends UiHandler {
if (this.optionCursors[cursor] < this.optionValueLabels[cursor].length - 1)
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
break;
case Button.LB:
case Button.CYCLE_FORM:
this.scene.ui.setMode(Mode.SETTINGS)
success = true;
case Button.RB:
case Button.CYCLE_SHINY:
this.scene.ui.setMode(Mode.SETTINGS)
success = true;
break;

View File

@ -187,11 +187,11 @@ export default class SettingsUiHandler extends UiHandler {
if (this.optionCursors[cursor] < this.optionValueLabels[cursor].length - 1)
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
break;
case Button.LB:
case Button.CYCLE_FORM:
this.scene.ui.setMode(Mode.SETTINGS_GAMEPAD)
success = true;
break;
case Button.RB:
case Button.CYCLE_SHINY:
this.scene.ui.setMode(Mode.SETTINGS_GAMEPAD)
success = true;
break;

View File

@ -969,7 +969,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const row = Math.floor(this.cursor / 9);
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
switch (button) {
case Button.RB:
case Button.CYCLE_SHINY:
if (this.canCycleShiny) {
this.setSpeciesDetails(this.lastSpecies, !props.shiny, undefined, undefined, props.shiny ? 0 : undefined, undefined, undefined);
if (this.dexAttrCursor & DexAttr.SHINY)
@ -978,7 +978,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
success = true;
}
break;
case Button.LB:
case Button.CYCLE_FORM:
if (this.canCycleForm) {
const formCount = this.lastSpecies.forms.length;
let newFormIndex = props.formIndex;