mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 08:46:55 +00:00
Fix Errors in ui-inputs.ts (#1549)
This commit is contained in:
parent
9e0fd33510
commit
a880185289
@ -6,17 +6,16 @@ import StarterSelectUiHandler from "./ui/starter-select-ui-handler";
|
|||||||
import {Setting, settingOptions} from "./system/settings";
|
import {Setting, settingOptions} from "./system/settings";
|
||||||
import SettingsUiHandler from "./ui/settings-ui-handler";
|
import SettingsUiHandler from "./ui/settings-ui-handler";
|
||||||
import {Button} from "./enums/buttons";
|
import {Button} from "./enums/buttons";
|
||||||
|
import BattleScene from "./battle-scene";
|
||||||
|
|
||||||
export interface ActionKeys {
|
type ActionKeys = Record<Button, () => void>;
|
||||||
[key in Button]: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UiInputs {
|
export class UiInputs {
|
||||||
private scene: Phaser.Scene;
|
private scene: BattleScene;
|
||||||
private events: Phaser.Events;
|
private events: Phaser.Events.EventEmitter;
|
||||||
private inputsController: InputsController;
|
private inputsController: InputsController;
|
||||||
|
|
||||||
constructor(scene: Phaser.Scene, inputsController: InputsController) {
|
constructor(scene: BattleScene, inputsController: InputsController) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.inputsController = inputsController;
|
this.inputsController = inputsController;
|
||||||
this.init();
|
this.init();
|
||||||
@ -52,30 +51,48 @@ export class UiInputs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getActionsKeyDown(): ActionKeys {
|
getActionsKeyDown(): ActionKeys {
|
||||||
const actions = {};
|
const actions: ActionKeys = {
|
||||||
actions[Button.UP] = () => this.buttonDirection(Button.UP);
|
[Button.UP]: () => this.buttonDirection(Button.UP),
|
||||||
actions[Button.DOWN] = () => this.buttonDirection(Button.DOWN);
|
[Button.DOWN]: () => this.buttonDirection(Button.DOWN),
|
||||||
actions[Button.LEFT] = () => this.buttonDirection(Button.LEFT);
|
[Button.LEFT]: () => this.buttonDirection(Button.LEFT),
|
||||||
actions[Button.RIGHT] = () => this.buttonDirection(Button.RIGHT);
|
[Button.RIGHT]: () => this.buttonDirection(Button.RIGHT),
|
||||||
actions[Button.SUBMIT] = () => this.buttonTouch();
|
[Button.SUBMIT]: () => this.buttonTouch(),
|
||||||
actions[Button.ACTION] = () => this.buttonAb(Button.ACTION);
|
[Button.ACTION]: () => this.buttonDirection(Button.ACTION),
|
||||||
actions[Button.CANCEL] = () => this.buttonAb(Button.CANCEL);
|
[Button.CANCEL]: () => this.buttonDirection(Button.CANCEL),
|
||||||
actions[Button.MENU] = () => this.buttonMenu();
|
[Button.MENU]: () => this.buttonMenu(),
|
||||||
actions[Button.STATS] = () => this.buttonStats(true);
|
[Button.STATS]: () => this.buttonStats(true),
|
||||||
actions[Button.CYCLE_SHINY] = () => this.buttonCycleOption(Button.CYCLE_SHINY);
|
[Button.CYCLE_SHINY]: () => this.buttonDirection(Button.CYCLE_SHINY),
|
||||||
actions[Button.CYCLE_FORM] = () => this.buttonCycleOption(Button.CYCLE_FORM);
|
[Button.CYCLE_FORM]: () => this.buttonDirection(Button.CYCLE_FORM),
|
||||||
actions[Button.CYCLE_GENDER] = () => this.buttonCycleOption(Button.CYCLE_GENDER);
|
[Button.CYCLE_GENDER]: () => this.buttonDirection(Button.CYCLE_GENDER),
|
||||||
actions[Button.CYCLE_ABILITY] = () => this.buttonCycleOption(Button.CYCLE_ABILITY);
|
[Button.CYCLE_ABILITY]: () => this.buttonDirection(Button.CYCLE_ABILITY),
|
||||||
actions[Button.CYCLE_NATURE] = () => this.buttonCycleOption(Button.CYCLE_NATURE);
|
[Button.CYCLE_NATURE]: () => this.buttonDirection(Button.CYCLE_NATURE),
|
||||||
actions[Button.CYCLE_VARIANT] = () => this.buttonCycleOption(Button.CYCLE_VARIANT);
|
[Button.CYCLE_VARIANT]: () => this.buttonDirection(Button.CYCLE_VARIANT),
|
||||||
actions[Button.SPEED_UP] = () => this.buttonSpeedChange();
|
[Button.SPEED_UP]: () => this.buttonSpeedChange(),
|
||||||
actions[Button.SLOW_DOWN] = () => this.buttonSpeedChange(false);
|
[Button.SLOW_DOWN]: () => this.buttonSpeedChange(false),
|
||||||
|
};
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
getActionsKeyUp(): ActionKeys {
|
getActionsKeyUp(): ActionKeys {
|
||||||
const actions = {};
|
const actions: ActionKeys = {
|
||||||
actions[Button.STATS] = () => this.buttonStats(false);
|
[Button.UP]: () => undefined,
|
||||||
|
[Button.DOWN]: () => undefined,
|
||||||
|
[Button.LEFT]: () => undefined,
|
||||||
|
[Button.RIGHT]: () => undefined,
|
||||||
|
[Button.SUBMIT]: () => undefined,
|
||||||
|
[Button.ACTION]: () => undefined,
|
||||||
|
[Button.CANCEL]: () => undefined,
|
||||||
|
[Button.MENU]: () => undefined,
|
||||||
|
[Button.STATS]: () => this.buttonStats(false),
|
||||||
|
[Button.CYCLE_SHINY]: () => undefined,
|
||||||
|
[Button.CYCLE_FORM]: () => undefined,
|
||||||
|
[Button.CYCLE_GENDER]: () => undefined,
|
||||||
|
[Button.CYCLE_ABILITY]: () => undefined,
|
||||||
|
[Button.CYCLE_NATURE]: () => undefined,
|
||||||
|
[Button.CYCLE_VARIANT]: () => undefined,
|
||||||
|
[Button.SPEED_UP]: () => undefined,
|
||||||
|
[Button.SLOW_DOWN]: () => undefined,
|
||||||
|
};
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user