mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-13 20:02:19 +02:00
move getGamepadType function to ui.ts
This commit is contained in:
parent
f1bb5fbce8
commit
c8331d1225
@ -23,7 +23,6 @@ import {modifierSortFunc} from "../modifier/modifier";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { PlayerGender } from "#enums/player-gender";
|
import { PlayerGender } from "#enums/player-gender";
|
||||||
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||||
import { Device } from "#enums/devices";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RunInfoUiMode indicates possible overlays of RunInfoUiHandler.
|
* RunInfoUiMode indicates possible overlays of RunInfoUiHandler.
|
||||||
@ -154,7 +153,7 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
const headerBgCoords = headerBg.getTopRight();
|
const headerBgCoords = headerBg.getTopRight();
|
||||||
const abilityButtonContainer = this.scene.add.container(0, 0);
|
const abilityButtonContainer = this.scene.add.container(0, 0);
|
||||||
const abilityButtonText = addTextObject(this.scene, 8, 0, i18next.t("runHistory:viewHeldItems"), TextStyle.WINDOW, {fontSize:"34px"});
|
const abilityButtonText = addTextObject(this.scene, 8, 0, i18next.t("runHistory:viewHeldItems"), TextStyle.WINDOW, {fontSize:"34px"});
|
||||||
const gamepadType = this.getGamepadType();
|
const gamepadType = this.getUi().getGamepadType();
|
||||||
let abilityButtonElement: Phaser.GameObjects.Sprite;
|
let abilityButtonElement: Phaser.GameObjects.Sprite;
|
||||||
if (gamepadType === "touch") {
|
if (gamepadType === "touch") {
|
||||||
abilityButtonElement = new Phaser.GameObjects.Sprite(this.scene, 0, 2, "keyboard", "E.png");
|
abilityButtonElement = new Phaser.GameObjects.Sprite(this.scene, 0, 2, "keyboard", "E.png");
|
||||||
@ -190,7 +189,7 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
const hallofFameInstructionContainer = this.scene.add.container(0, 0);
|
const hallofFameInstructionContainer = this.scene.add.container(0, 0);
|
||||||
const shinyButtonText = addTextObject(this.scene, 8, 0, i18next.t("runHistory:viewHallOfFame"), TextStyle.WINDOW, {fontSize:"65px"});
|
const shinyButtonText = addTextObject(this.scene, 8, 0, i18next.t("runHistory:viewHallOfFame"), TextStyle.WINDOW, {fontSize:"65px"});
|
||||||
const formButtonText = addTextObject(this.scene, 8, 12, i18next.t("runHistory:viewEndingSplash"), TextStyle.WINDOW, {fontSize:"65px"});
|
const formButtonText = addTextObject(this.scene, 8, 12, i18next.t("runHistory:viewEndingSplash"), TextStyle.WINDOW, {fontSize:"65px"});
|
||||||
const gamepadType = this.getGamepadType();
|
const gamepadType = this.getUi().getGamepadType();
|
||||||
let shinyButtonElement: Phaser.GameObjects.Sprite;
|
let shinyButtonElement: Phaser.GameObjects.Sprite;
|
||||||
let formButtonElement: Phaser.GameObjects.Sprite;
|
let formButtonElement: Phaser.GameObjects.Sprite;
|
||||||
if (gamepadType === "touch") {
|
if (gamepadType === "touch") {
|
||||||
@ -899,20 +898,5 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* getGamepadType - returns the type of gamepad being used
|
|
||||||
* inputMethod could be "keyboard" or "touch" or "gamepad"
|
|
||||||
* if inputMethod is "keyboard" or "touch", then the inputMethod is returned
|
|
||||||
* if inputMethod is "gamepad", then the gamepad type is returned it could be "xbox" or "duelshock"
|
|
||||||
* @returns gamepad type
|
|
||||||
*/
|
|
||||||
private getGamepadType(): string {
|
|
||||||
if (this.scene.inputMethod === "gamepad") {
|
|
||||||
return this.scene.inputController.getConfig(this.scene.inputController.selectedDevice[Device.GAMEPAD]).padType;
|
|
||||||
} else {
|
|
||||||
return this.scene.inputMethod;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
src/ui/ui.ts
17
src/ui/ui.ts
@ -52,6 +52,7 @@ import RunInfoUiHandler from "./run-info-ui-handler";
|
|||||||
import EggSummaryUiHandler from "./egg-summary-ui-handler";
|
import EggSummaryUiHandler from "./egg-summary-ui-handler";
|
||||||
import TestDialogueUiHandler from "#app/ui/test-dialogue-ui-handler";
|
import TestDialogueUiHandler from "#app/ui/test-dialogue-ui-handler";
|
||||||
import AutoCompleteUiHandler from "./autocomplete-ui-handler";
|
import AutoCompleteUiHandler from "./autocomplete-ui-handler";
|
||||||
|
import { Device } from "#enums/devices";
|
||||||
|
|
||||||
export enum Mode {
|
export enum Mode {
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
@ -560,4 +561,20 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||||||
public getModeChain(): Mode[] {
|
public getModeChain(): Mode[] {
|
||||||
return this.modeChain;
|
return this.modeChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getGamepadType - returns the type of gamepad being used
|
||||||
|
* inputMethod could be "keyboard" or "touch" or "gamepad"
|
||||||
|
* if inputMethod is "keyboard" or "touch", then the inputMethod is returned
|
||||||
|
* if inputMethod is "gamepad", then the gamepad type is returned it could be "xbox" or "duelshock"
|
||||||
|
* @returns gamepad type
|
||||||
|
*/
|
||||||
|
public getGamepadType(): string {
|
||||||
|
const scene = this.scene as BattleScene;
|
||||||
|
if (scene.inputMethod === "gamepad") {
|
||||||
|
return scene.inputController.getConfig(scene.inputController.selectedDevice[Device.GAMEPAD]).padType;
|
||||||
|
} else {
|
||||||
|
return scene.inputMethod;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user