This commit is contained in:
Brian 2025-09-23 04:08:02 +00:00 committed by GitHub
commit aa97cefe8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 343 additions and 22 deletions

View File

@ -229,6 +229,7 @@ export class BattleScene extends SceneBase {
public fusionPaletteSwaps = true;
public enableTouchControls = false;
public enableVibration = false;
public enableHotkeyTips = false;
public showBgmBar = true;
public hideUsername = false;
/** Determines the selected battle style. */
@ -269,6 +270,7 @@ export class BattleScene extends SceneBase {
public lastEnemyTrainer: Trainer | null;
public currentBattle: Battle;
public pokeballCounts: PokeballCounts;
public lastPokeballType: PokeballType = PokeballType.POKEBALL;
public money: number;
public pokemonInfoContainer: PokemonInfoContainer;
private party: PlayerPokemon[];

View File

@ -92,6 +92,25 @@ export function getIconWithSettingName(config, settingName) {
return getIconWithKey(config, key);
}
/**
* Retrieve key from input keys eg: return "R" from "KEY_R"
* @param configs
* @param source Source of last input type. Eg: "gamepad"
* @param devices List of all devices.
* @param settingName Action for the input key.
* @returns
*/
export function getKeyForLatestInput(configs, source, devices, settingName) {
let config: any;
if (source === "gamepad") {
config = configs[devices[Device.GAMEPAD]];
} else {
config = configs[devices[Device.KEYBOARD]];
}
const key = Object.keys(config["custom"]).find(k => config["custom"][k] === settingName);
return key?.slice(4);
}
export function getIconForLatestInput(configs, source, devices, settingName) {
let config: any; // TODO: refine type
if (source === "gamepad") {

View File

@ -4,7 +4,13 @@ import { Button } from "#enums/buttons";
import { Device } from "#enums/devices";
import { UiMode } from "#enums/ui-mode";
import cfg_keyboard_qwerty from "#inputs/cfg-keyboard-qwerty";
import { assign, getButtonWithKeycode, getIconForLatestInput, swap } from "#inputs/config-handler";
import {
assign,
getButtonWithKeycode,
getIconForLatestInput,
getKeyForLatestInput,
swap,
} from "#inputs/config-handler";
import pad_dualshock from "#inputs/pad-dualshock";
import pad_generic from "#inputs/pad-generic";
import pad_procon from "#inputs/pad-procon";
@ -540,6 +546,13 @@ export class InputsController {
return getIconForLatestInput(this.configs, this.lastSource, this.selectedDevice, settingName);
}
getKeyForLatestInputRecorded(settingName) {
if (this.lastSource === "keyboard") {
this.ensureKeyboardIsInit();
}
return getKeyForLatestInput(this.configs, this.lastSource, this.selectedDevice, settingName);
}
getLastSourceDevice(): Device {
if (this.lastSource === "gamepad") {
return Device.GAMEPAD;

View File

@ -56,6 +56,7 @@ export class AttemptCapturePhase extends PokemonPhase {
}
globalScene.pokeballCounts[this.pokeballType]--;
globalScene.lastPokeballType = this.pokeballType;
this.originalY = pokemon.y;

View File

@ -151,6 +151,7 @@ export const SettingKeys = {
Tutorials: "TUTORIALS",
Touch_Controls: "TOUCH_CONTROLS",
Vibration: "VIBRATION",
HotkeyTips: "HOTKEY_TIPS",
Language: "LANGUAGE",
UI_Theme: "UI_THEME",
Window_Type: "WINDOW_TYPE",
@ -386,6 +387,13 @@ export const Setting: Array<Setting> = [
default: 0,
type: SettingType.GENERAL,
},
{
key: SettingKeys.HotkeyTips,
label: i18next.t("settings:hotkeyTips"),
options: OFF_ON,
default: 0,
type: SettingType.GENERAL,
},
{
key: SettingKeys.Touch_Controls,
label: i18next.t("settings:touchControls"),
@ -906,6 +914,9 @@ export function setSetting(setting: string, value: number): boolean {
case SettingKeys.Vibration:
globalScene.enableVibration = Setting[index].options[value].value !== "Disabled" && hasTouchscreen();
break;
case SettingKeys.HotkeyTips:
globalScene.enableHotkeyTips = Setting[index].options[value].value !== "On";
break;
case SettingKeys.Type_Hints:
globalScene.typeHints = Setting[index].options[value].value === "On";
break;

View File

@ -3,7 +3,9 @@ import type { InputsController } from "#app/inputs-controller";
import { Button } from "#enums/buttons";
import { UiMode } from "#enums/ui-mode";
import { Setting, SettingKeys, settingIndex } from "#system/settings";
import { CommandUiHandler } from "#ui/handlers/command-ui-handler";
import type { MessageUiHandler } from "#ui/message-ui-handler";
import { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler";
import { PokedexPageUiHandler } from "#ui/pokedex-page-ui-handler";
import { PokedexUiHandler } from "#ui/pokedex-ui-handler";
import { RunInfoUiHandler } from "#ui/run-info-ui-handler";
@ -85,8 +87,8 @@ export class UiInputs {
[Button.LEFT]: () => this.buttonDirection(Button.LEFT),
[Button.RIGHT]: () => this.buttonDirection(Button.RIGHT),
[Button.SUBMIT]: () => this.buttonTouch(),
[Button.ACTION]: () => this.buttonAb(Button.ACTION),
[Button.CANCEL]: () => this.buttonAb(Button.CANCEL),
[Button.ACTION]: () => this.buttonAB(Button.ACTION),
[Button.CANCEL]: () => this.buttonAB(Button.CANCEL),
[Button.MENU]: () => this.buttonMenu(),
[Button.STATS]: () => this.buttonGoToFilter(Button.STATS),
[Button.CYCLE_SHINY]: () => this.buttonCycleOption(Button.CYCLE_SHINY),
@ -130,7 +132,18 @@ export class UiInputs {
this.doVibration(inputSuccess, vibrationLength);
}
buttonAb(button: Button): void {
buttonAB(button: Button): void {
if (this.isInSettings()) {
/**
* When exiting the settings menu, this function
* will update the the UI to update the text.
* Eg: (E) Throw Poke ball -> (Shift) Throw Poke ball
*/
const whiteListUIModes: UiMode[] = [UiMode.MODIFIER_SELECT, UiMode.COMMAND];
for (const uiMode of whiteListUIModes) {
globalScene.ui.handlers[uiMode].updateTipsText();
}
}
globalScene.ui.processInput(button);
}
@ -213,6 +226,8 @@ export class UiInputs {
SettingsAudioUiHandler,
SettingsGamepadUiHandler,
SettingsKeyboardUiHandler,
CommandUiHandler,
ModifierSelectUiHandler,
];
const uiHandler = globalScene.ui?.getHandler();
if (whitelist.some(handler => uiHandler instanceof handler)) {
@ -246,4 +261,15 @@ export class UiInputs {
(globalScene.ui.getHandler() as SettingsUiHandler).show([]);
}
}
private isInSettings(): boolean {
const settingsModes: readonly UiMode[] = [
UiMode.SETTINGS,
UiMode.SETTINGS_AUDIO,
UiMode.SETTINGS_DISPLAY,
UiMode.SETTINGS_GAMEPAD,
UiMode.SETTINGS_KEYBOARD,
] as const;
return settingsModes.includes(globalScene.ui?.getMode());
}
}

View File

@ -1,6 +1,8 @@
import { globalScene } from "#app/global-scene";
import { getPokemonNameWithAffix } from "#app/messages";
import { getPokeballName } from "#data/pokeball";
import { getTypeRgb } from "#data/type";
import { BattleType } from "#enums/battle-type";
import { Button } from "#enums/buttons";
import { Command } from "#enums/command";
import { PokemonType } from "#enums/pokemon-type";
@ -9,12 +11,19 @@ import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode";
import { TerastallizeAccessModifier } from "#modifiers/modifier";
import type { CommandPhase } from "#phases/command-phase";
import { SettingKeyboard } from "#system/settings-keyboard";
import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler";
import { addTextObject } from "#ui/text";
import { UiHandler } from "#ui/ui-handler";
import i18next from "i18next";
const OPTION_BUTTON_YPOSITION = -62;
export class CommandUiHandler extends UiHandler {
private throwBallTextContainer: Phaser.GameObjects.Container;
private throwBallText: Phaser.GameObjects.Text;
private restartBattleTextContainer: Phaser.GameObjects.Container;
private restartBattleText: Phaser.GameObjects.Text;
private commandsContainer: Phaser.GameObjects.Container;
private cursorObj: Phaser.GameObjects.Image | null;
@ -63,14 +72,57 @@ export class CommandUiHandler extends UiHandler {
commandText.setName(commands[c]);
this.commandsContainer.add(commandText);
}
this.throwBallTextContainer = globalScene.add.container(16, OPTION_BUTTON_YPOSITION);
this.throwBallTextContainer.setName("throwBall-txt");
this.throwBallTextContainer.setVisible(false);
ui.add(this.throwBallTextContainer);
const throwBallKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)}) `
: "";
const lastPokeball =
" "
+ getPokeballName(globalScene.lastPokeballType)
+ " x"
+ globalScene.pokeballCounts[globalScene.lastPokeballType];
this.throwBallText = addTextObject(
-4,
-2,
i18next.t("commandUiHandler:throwBall", { throwBallKey, lastPokeball }),
TextStyle.PARTY,
);
this.throwBallText.setName("text-reroll-btn");
this.throwBallText.setOrigin(0, 0);
this.throwBallTextContainer.add(this.throwBallText);
this.restartBattleTextContainer = globalScene.add.container(16, OPTION_BUTTON_YPOSITION);
this.restartBattleTextContainer.setVisible(false);
ui.add(this.restartBattleTextContainer);
const retryBattleKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)}) `
: "";
this.restartBattleText = addTextObject(
-4,
-2,
i18next.t("commandUiHandler:retryBattle", { retryBattleKey }),
TextStyle.PARTY,
);
this.restartBattleText.setOrigin(0, 0);
this.restartBattleTextContainer.add(this.restartBattleText);
}
show(args: any[]): boolean {
super.show(args);
this.fieldIndex = args.length > 0 ? (args[0] as number) : 0;
this.commandsContainer.setVisible(true);
this.updateTipsText();
let commandPhase: CommandPhase;
const currentPhase = globalScene.phaseManager.getCurrentPhase();
@ -187,6 +239,77 @@ export class CommandUiHandler extends UiHandler {
this.toggleTeraButton();
}
break;
case Button.CYCLE_SHINY: {
/**
* When the Cycle Shiny button is pressed,
* the last pokeball will be thrown.
* This can only be used in the UiMode.COMMAND.
*/
const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase;
if (
globalScene.currentBattle.battleType === BattleType.WILD
&& globalScene.pokeballCounts[globalScene.lastPokeballType]
&& commandPhase.handleCommand(Command.BALL, globalScene.lastPokeballType)
) {
globalScene.ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex());
globalScene.ui.setMode(UiMode.MESSAGE);
success = true;
} else {
ui.playError();
}
break;
}
case Button.CYCLE_ABILITY:
/**
* When the Cycle Ability button is pressed,
* the UI will request the user if they would like
* to restart the battle. This can only be used in
* the UiMode.COMMAND.
*/
if (!globalScene.enableRetries) {
break;
}
globalScene.ui.setMode(UiMode.MESSAGE);
globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
globalScene.ui.setMode(
UiMode.CONFIRM,
() => {
globalScene.ui.fadeOut(1250).then(() => {
globalScene.reset();
globalScene.phaseManager.clearPhaseQueue();
globalScene.gameData.loadSession(globalScene.sessionSlotId).then(() => {
globalScene.phaseManager.pushNew("EncounterPhase", true);
const availablePartyMembers = globalScene.getPokemonAllowedInBattle().length;
globalScene.phaseManager.pushNew("SummonPhase", 0);
if (globalScene.currentBattle.double && availablePartyMembers > 1) {
globalScene.phaseManager.pushNew("SummonPhase", 1);
}
if (
globalScene.currentBattle.waveIndex > 1
&& globalScene.currentBattle.battleType !== BattleType.TRAINER
) {
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
if (globalScene.currentBattle.double && availablePartyMembers > 1) {
globalScene.phaseManager.pushNew("CheckSwitchPhase", 1, globalScene.currentBattle.double);
}
}
globalScene.ui.fadeIn(1250);
globalScene.phaseManager.shiftPhase();
});
});
},
() => {
globalScene.ui.setMode(UiMode.COMMAND);
},
false,
0,
0,
1000,
);
});
break;
}
}
@ -218,16 +341,16 @@ export class CommandUiHandler extends UiHandler {
}
getCursor(): number {
return !this.fieldIndex ? this.cursor : this.cursor2;
return this.fieldIndex ? this.cursor2 : this.cursor;
}
setCursor(cursor: number): boolean {
const changed = this.getCursor() !== cursor;
if (changed) {
if (!this.fieldIndex) {
this.cursor = cursor;
} else {
if (this.fieldIndex) {
this.cursor2 = cursor;
} else {
this.cursor = cursor;
}
}
@ -250,6 +373,8 @@ export class CommandUiHandler extends UiHandler {
super.clear();
this.getUi().getMessageHandler().commandWindow.setVisible(false);
this.commandsContainer.setVisible(false);
this.throwBallTextContainer.setVisible(false);
this.restartBattleTextContainer.setVisible(false);
this.getUi().getMessageHandler().clearText();
this.eraseCursor();
}
@ -260,4 +385,37 @@ export class CommandUiHandler extends UiHandler {
}
this.cursorObj = null;
}
/**
* To update text in the command when globalScene.enableHotkeyTips
* is turned off or when action keys are changed.
*/
updateTipsText(): void {
const throwBallKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)}) `
: "";
const lastPokeball =
" "
+ getPokeballName(globalScene.lastPokeballType)
+ " x"
+ globalScene.pokeballCounts[globalScene.lastPokeballType];
this.throwBallText.setText(i18next.t("commandUiHandler:throwBall", { throwBallKey, lastPokeball }));
const retryBattleKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)}) `
: "";
this.restartBattleText.setText(i18next.t("commandUiHandler:retryBattle", { retryBattleKey }));
this.throwBallTextContainer.setVisible(
!globalScene.enableHotkeyTips && globalScene.currentBattle.battleType === BattleType.WILD,
);
this.restartBattleTextContainer.setVisible(!globalScene.enableHotkeyTips);
this.restartBattleTextContainer.setPositionRelative(
this.throwBallTextContainer,
0,
globalScene.currentBattle.battleType === BattleType.WILD ? -12 : 0,
);
}
}

View File

@ -11,6 +11,7 @@ import { UiMode } from "#enums/ui-mode";
import { HealShopCostModifier, LockModifierTiersModifier, PokemonHeldItemModifier } from "#modifiers/modifier";
import type { ModifierTypeOption } from "#modifiers/modifier-type";
import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "#modifiers/modifier-type";
import { SettingKeyboard } from "#system/settings-keyboard";
import { AwaitableUiHandler } from "#ui/awaitable-ui-handler";
import { MoveInfoOverlay } from "#ui/move-info-overlay";
import { addTextObject, getModifierTierTextTint, getTextColor, getTextStyleOptions } from "#ui/text";
@ -31,6 +32,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
private checkButtonContainer: Phaser.GameObjects.Container;
private continueButtonContainer: Phaser.GameObjects.Container;
private rerollCostText: Phaser.GameObjects.Text;
private rerollButtonText: Phaser.GameObjects.Text;
private lockRarityButtonText: Phaser.GameObjects.Text;
private moveInfoOverlay: MoveInfoOverlay;
private moveInfoOverlayActive = false;
@ -101,25 +103,40 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.rerollButtonContainer.setVisible(false);
ui.add(this.rerollButtonContainer);
const rerollButtonText = addTextObject(-4, -2, i18next.t("modifierSelectUiHandler:reroll"), TextStyle.PARTY);
rerollButtonText.setName("text-reroll-btn");
rerollButtonText.setOrigin(0, 0);
this.rerollButtonContainer.add(rerollButtonText);
const rerollKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)}) `
: "";
this.rerollButtonText = addTextObject(
-4,
-2,
i18next.t("modifierSelectUiHandler:reroll", { rerollKey }),
TextStyle.PARTY,
);
this.rerollButtonText.setName("text-reroll-btn");
this.rerollButtonText.setOrigin(0, 0);
this.rerollButtonContainer.add(this.rerollButtonText);
this.rerollCostText = addTextObject(0, 0, "", TextStyle.MONEY);
this.rerollCostText.setName("text-reroll-cost");
this.rerollCostText.setOrigin(0, 0);
this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1);
this.rerollCostText.setPositionRelative(this.rerollButtonText, this.rerollButtonText.displayWidth + 5, 1);
this.rerollButtonContainer.add(this.rerollCostText);
this.lockRarityButtonContainer = globalScene.add.container(16, OPTION_BUTTON_YPOSITION);
this.lockRarityButtonContainer.setVisible(false);
ui.add(this.lockRarityButtonContainer);
const lockRarityKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)}) `
: "";
this.lockRarityButtonText = addTextObject(
-4,
-2,
i18next.t("modifierSelectUiHandler:lockRarities"),
i18next.t("modifierSelectUiHandler:lockRarities", { lockRarityKey }),
TextStyle.PARTY,
);
this.lockRarityButtonText.setOrigin(0, 0);
@ -156,6 +173,15 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
globalScene.addInfoToggle(this.moveInfoOverlay);
}
/**
* To update text in the command when globalScene.enableHotkeyTips
* is turned off or when action keys are changed.
*/
updateTipsText(): void {
this.updateRerollText();
this.updateRerollCostPosition();
}
show(args: any[]): boolean {
globalScene.disableMenu = false;
@ -181,7 +207,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
const partyHasHeldItem =
this.player
&& globalScene.findModifiers(m => m instanceof PokemonHeldItemModifier && m.isTransferable).length > 0;
const canLockRarities = !!globalScene.findModifier(m => m instanceof LockModifierTiersModifier);
const canLockRarities = !globalScene.findModifier(m => m instanceof LockModifierTiersModifier);
this.transferButtonContainer.setVisible(false);
this.transferButtonContainer.setAlpha(0);
@ -201,7 +227,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.rerollButtonContainer.setPositionRelative(this.lockRarityButtonContainer, 0, canLockRarities ? -12 : 0);
this.rerollCost = args[3] as number;
this.updateRerollText();
this.updateRerollCostText();
const typeOptions = args[1] as ModifierTypeOption[];
@ -408,13 +434,13 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
const originalOnActionInput = this.onActionInput;
this.awaitingActionInput = false;
this.onActionInput = null;
if (!originalOnActionInput(this.rowCursor, this.cursor)) {
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
} else {
if (originalOnActionInput(this.rowCursor, this.cursor)) {
this.moveInfoOverlayActive = this.moveInfoOverlay.active;
this.moveInfoOverlay.setVisible(false);
this.moveInfoOverlay.active = false; // this is likely unnecessary, but it should help future prove the UI
} else {
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
}
}
} else if (button === Button.CANCEL) {
@ -519,6 +545,30 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
success = this.setCursor(0);
}
break;
case Button.CYCLE_SHINY:
/**
* When the Cycle Shiny button is pressed,
* a reroll command will be played.
*/
if (this.onActionInput && globalScene.money >= this.rerollCost) {
const originalOnActionInput = this.onActionInput;
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
originalOnActionInput(0, 0);
}
break;
case Button.CYCLE_ABILITY:
/**
* When the Cycle Ability button is pressed,
* the lock rarity will be enabled/disabled.
*/
if (this.onActionInput && this.lockRarityButtonContainer.visible) {
const originalOnActionInput = this.onActionInput;
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
originalOnActionInput(0, 3);
}
break;
}
}
@ -666,10 +716,38 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
for (const shopOption of shopOptions) {
shopOption.updateCostText();
}
this.updateRerollText();
this.updateRerollCostText();
}
updateRerollText(): void {
const rerollKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)}) `
: "";
this.rerollButtonText.setText(i18next.t("modifierSelectUiHandler:reroll", { rerollKey }));
if (this.lockRarityButtonText.visible) {
const lockRarityKey = globalScene.enableHotkeyTips
? ""
: globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)
? `(${globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Ability)}) `
: "";
this.lockRarityButtonText.setText(i18next.t("modifierSelectUiHandler:lockRarities", { lockRarityKey }));
}
}
updateRerollCostPosition(): void {
if (globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)) {
const rerollKey = globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny);
this.rerollCostText.setPositionRelative(
this.rerollButtonText,
this.rerollButtonText.displayWidth + 5 + (rerollKey?.length ?? 0),
1,
);
}
}
updateRerollCostText(): void {
const rerollDisabled = this.rerollCost < 0;
if (rerollDisabled) {
@ -684,6 +762,14 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.rerollCostText.setText(i18next.t("modifierSelectUiHandler:rerollCost", { formattedMoney }));
this.rerollCostText.setColor(getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED));
this.rerollCostText.setShadowColor(getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED, true));
if (globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny)) {
const rerollKey = globalScene.inputController?.getKeyForLatestInputRecorded(SettingKeyboard.Button_Cycle_Shiny);
this.rerollCostText.setPositionRelative(
this.rerollButtonText,
this.rerollButtonText.displayWidth + 5 + (rerollKey?.length ?? 0),
1,
);
}
}
updateLockRaritiesText(): void {

View File

@ -25,6 +25,8 @@ export abstract class UiHandler {
return true;
}
updateTipsText() {}
abstract processInput(button: Button): boolean;
getUi() {

View File

@ -451,6 +451,9 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler {
// Retrieve the layout settings based on the type of the gamepad.
const layout = this.layout[configType];
// Update the main controller with configuration details from the selected layout.
if (!layout) {
return false;
}
this.keys = layout.keys;
this.optionsContainer = layout.optionsContainer;
this.optionsContainer.setVisible(true);