pokerogue/src/ui-inputs.ts

218 lines
7.8 KiB
TypeScript
Raw Normal View History

import Phaser from "phaser";
import {Mode} from "./ui/ui";
import {InputsController} from "./inputs-controller";
import MessageUiHandler from "./ui/message-ui-handler";
import StarterSelectUiHandler from "./ui/starter-select-ui-handler";
2024-06-03 23:57:47 +00:00
import {Setting, SettingKeys, settingIndex} from "./system/settings/settings";
import SettingsUiHandler from "./ui/settings/settings-ui-handler";
import {Button} from "#enums/buttons";
import SettingsGamepadUiHandler from "./ui/settings/settings-gamepad-ui-handler";
import SettingsKeyboardUiHandler from "#app/ui/settings/settings-keyboard-ui-handler";
2024-05-29 12:16:57 +00:00
import BattleScene from "./battle-scene";
import SettingsDisplayUiHandler from "./ui/settings/settings-display-ui-handler";
import SettingsAudioUiHandler from "./ui/settings/settings-audio-ui-handler";
[QoL][Feature] Hall of Fame + Run History (#3251) * Fixed SaveSessionData issue + Added loss details + removed Modifiers * Final changes * Updated code with the current repo + mode localization * Final touches before moving to a clean branch * Manual merging * Some more merging + updating * Fixed import * TypeDocs issues * Fixed relevant typedoc issues * Manual merge * More fixes * So many commits for so little * Localization Updates * Very barebones implementation of 'favorite' runs - not planning to implement any time soon though * menu-ui-handler.ts localizations * Update src/locales/ko/run-history-ui-handler.ts Thank you! Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * The German name for Squirtle is silly * Fixed Run-Entry Def * Commented out networking functionality * Commenting out network functionality pt2 * Update src/locales/pt_BR/menu-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/pt_BR/run-history-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/ko/menu-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_CN/menu-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/zh_CN/run-history-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/fr/menu-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/it/menu-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Fixed SaveSessionData issue + Added loss details + removed Modifiers * Final changes * Updated code with the current repo + mode localization * Final touches before moving to a clean branch * Manual merging * Some more merging + updating * Fixed import * TypeDocs issues * Fixed relevant typedoc issues * Manual merge * More fixes * So many commits for so little * Localization Updates * Very barebones implementation of 'favorite' runs - not planning to implement any time soon though * menu-ui-handler.ts localizations * Update src/locales/ko/run-history-ui-handler.ts Thank you! Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * The German name for Squirtle is silly * Fixed Run-Entry Def * Commented out networking functionality * Commenting out network functionality pt2 * Fixed cursor-close out freeze and replaced hall of fame background * Removed console.log * Fixed cursor freeze bug + changed hall of fame background * cursor freeze bug fix pt 2 * Revert "Disable egg gacha in rewards (#3304)" This reverts commit 3a87c8657fa8c65b306a7b7bc883a834002485c2. * Merging menu-ui-handler.ts * Merging phases.ts * Manual merge for game-data.ts * Manual merge locales/en/config.ts * Manual merge of menu-ui-handler.ts * Manual ui.ts merge * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Revert "Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into runHistoryNew" This reverts commit 5c6fcf6ec485ab0a967fd714d95928b04435a7ea, reversing changes made to 751bf4a43327118b24bc55cba3a5230f96eb6d27. * Revert "Revert "Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into runHistoryNew"" This reverts commit f6c3580ad096b587f9b30f5d0aeb4bc9d630f726. * Added ending art to victorious runs * Added darker overlay instead * Hall of Fame art * Actual BG Images * some bug fixing * some bug fixing p2 * some minor changes * some minor changes * Changed order of runs displayed to newest --> oldest * console.log for debugging * Export/Import Run History function * added import validation * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Felt coder's guilt for bad buttons implementation * strict-null changes * New Localizations * Update src/locales/fr/menu-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Apply suggestions from code review Thank you! Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Apply suggestions from code review run-info-ui-handler comments fix Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/locales/es/menu-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Update src/locales/es/menu-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Update src/locales/es/run-history-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Lost this file somehow * Added do not delete comments * Apply suggestions from code review Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * flx Changes * Localizations * Fixing Git test issues * Fixed issues found by Starkrieg * removed console log * Fixed cursor bugs * github pages issue * Update src/ui/run-info-ui-handler.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/ui/run-history-ui-handler.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Corrade's comments * The things I do for Github PAges * Preventing menu freeze * Double trainer battles and fresh start challenge * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/menu-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * Update src/locales/pt_BR/run-history-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/pt_BR/menu-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/it/menu-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/ko/run-history-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Apply suggestions from code review Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Localizations + Error Message Update Co-authored-by: protimita <protimitajp@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * small fixes * flx-sta suggestions + Localizations Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Added dynamic text positioning based on container size + small fixes * Thanks Adri1 ! Quick Fix for localizing wave in RunInfo * Transfered defeat parsing to smaller functions and added page modes * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Run History UI handler documentation * Fixed rival names * some comments * Apply suggestions from code review Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Finished documentation * Fixed incorrect rival name handling * Corrected limit-handling * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Cleaned up getrunhistorydata() per flx-sta's suggestions * Added some override tags? * Added scopes/override notes to classes/class variables/class functions * Moved code from phases.ts to game-over-phase.ts * Fixing game-data whoops * ughhhhh * Update src/ui/run-history-ui-handler.ts Co-authored-by: Adrián T. <99520451+Vassiat@users.noreply.github.com> * Fixed cursor and updated money. Note - need to fix money handling for Asian languages * Money appears according to settings * typedocs blah blah * cleaning up manage data options * Final flx fixes + No Run History handling * Translation update. --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: protimita <protimitajp@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: Adrián T. <99520451+Vassiat@users.noreply.github.com>
2024-08-23 18:23:16 +00:00
import RunInfoUiHandler from "./ui/run-info-ui-handler";
2024-05-29 12:16:57 +00:00
type ActionKeys = Record<Button, () => void>;
export class UiInputs {
2024-05-29 12:16:57 +00:00
private scene: BattleScene;
private events: Phaser.Events.EventEmitter;
private inputsController: InputsController;
2024-05-29 12:16:57 +00:00
constructor(scene: BattleScene, inputsController: InputsController) {
this.scene = scene;
this.inputsController = inputsController;
this.init();
}
init(): void {
this.events = this.inputsController.events;
this.listenInputs();
}
detectInputMethod(evt): void {
if (evt.controller_type === "keyboard") {
//if the touch property is present and defined, then this is a simulated keyboard event from the touch screen
if (evt.hasOwnProperty("isTouch") && evt.isTouch) {
this.scene.inputMethod = "touch";
} else {
this.scene.inputMethod = "keyboard";
}
} else if (evt.controller_type === "gamepad") {
this.scene.inputMethod = "gamepad";
}
}
listenInputs(): void {
this.events.on("input_down", (event) => {
this.detectInputMethod(event);
const actions = this.getActionsKeyDown();
if (!actions.hasOwnProperty(event.button)) {
return;
}
actions[event.button]();
}, this);
this.events.on("input_up", (event) => {
const actions = this.getActionsKeyUp();
if (!actions.hasOwnProperty(event.button)) {
return;
}
actions[event.button]();
}, this);
}
doVibration(inputSuccess: boolean, vibrationLength: number): void {
if (inputSuccess && this.scene.enableVibration && typeof navigator.vibrate !== "undefined") {
navigator.vibrate(vibrationLength);
}
}
getActionsKeyDown(): ActionKeys {
2024-05-29 12:16:57 +00:00
const actions: ActionKeys = {
[Button.UP]: () => this.buttonDirection(Button.UP),
[Button.DOWN]: () => this.buttonDirection(Button.DOWN),
[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),
2024-05-29 12:16:57 +00:00
[Button.MENU]: () => this.buttonMenu(),
[Enhancement] Add go filter shortcut (#3345) * update goFilter shortcut * fix filter instruction position * remove unnecessary new lines * update requested changes. add other language entries too * remove unnecessary case code * open dropdown when pressing goFilter shortcut * add missing entry for `fr` * Update src/locales/fr/starter-select-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/starter-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * update instruction container position and text offset for more longer instruction label. decrease size of fr instruction font * fixed de info font size * Update src/locales/pt_BR/starter-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/ko/starter-select-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_TW/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * Update src/locales/zh_CN/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * update font size, starterInfoXPos and starterInfoYOffset in zh. update starterInfoXPos in de * Update src/locales/es/starter-select-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com>
2024-08-08 19:34:20 +00:00
[Button.STATS]: () => this.buttonGoToFilter(Button.STATS),
[Button.CYCLE_SHINY]: () => this.buttonCycleOption(Button.CYCLE_SHINY),
[Button.CYCLE_FORM]: () => this.buttonCycleOption(Button.CYCLE_FORM),
[Button.CYCLE_GENDER]: () => this.buttonCycleOption(Button.CYCLE_GENDER),
[Button.CYCLE_ABILITY]: () => this.buttonCycleOption(Button.CYCLE_ABILITY),
[Button.CYCLE_NATURE]: () => this.buttonCycleOption(Button.CYCLE_NATURE),
[Button.V]: () => this.buttonCycleOption(Button.V),
2024-05-29 12:16:57 +00:00
[Button.SPEED_UP]: () => this.buttonSpeedChange(),
[Button.SLOW_DOWN]: () => this.buttonSpeedChange(false),
};
return actions;
}
getActionsKeyUp(): ActionKeys {
2024-05-29 12:16:57 +00:00
const actions: ActionKeys = {
[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.V]: () => this.buttonInfo(false),
2024-05-29 12:16:57 +00:00
[Button.SPEED_UP]: () => undefined,
[Button.SLOW_DOWN]: () => undefined,
};
return actions;
}
buttonDirection(direction: Button): void {
const inputSuccess = this.scene.ui.processInput(direction);
const vibrationLength = 5;
this.doVibration(inputSuccess, vibrationLength);
}
buttonAb(button: Button): void {
this.scene.ui.processInput(button);
}
buttonTouch(): void {
this.scene.ui.processInput(Button.SUBMIT) || this.scene.ui.processInput(Button.ACTION);
}
buttonStats(pressed: boolean = true): void {
// allow access to Button.STATS as a toggle for other elements
for (const t of this.scene.getInfoToggles(true)) {
t.toggleInfo(pressed);
}
// handle normal pokemon battle ui
for (const p of this.scene.getField().filter(p => p?.isActive(true))) {
p.toggleStats(pressed);
}
}
[Enhancement] Add go filter shortcut (#3345) * update goFilter shortcut * fix filter instruction position * remove unnecessary new lines * update requested changes. add other language entries too * remove unnecessary case code * open dropdown when pressing goFilter shortcut * add missing entry for `fr` * Update src/locales/fr/starter-select-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/starter-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * update instruction container position and text offset for more longer instruction label. decrease size of fr instruction font * fixed de info font size * Update src/locales/pt_BR/starter-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/ko/starter-select-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_TW/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * Update src/locales/zh_CN/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * update font size, starterInfoXPos and starterInfoYOffset in zh. update starterInfoXPos in de * Update src/locales/es/starter-select-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com>
2024-08-08 19:34:20 +00:00
buttonGoToFilter(button: Button): void {
const whitelist = [StarterSelectUiHandler];
const uiHandler = this.scene.ui?.getHandler();
if (whitelist.some(handler => uiHandler instanceof handler)) {
this.scene.ui.processInput(button);
} else {
this.buttonStats(true);
}
}
buttonInfo(pressed: boolean = true): void {
if (this.scene.showMovesetFlyout ) {
for (const p of this.scene.getField().filter(p => p?.isActive(true))) {
p.toggleFlyout(pressed);
}
}
if (this.scene.showArenaFlyout) {
this.scene.ui.processInfoButton(pressed);
}
}
buttonMenu(): void {
if (this.scene.disableMenu) {
return;
}
switch (this.scene.ui?.getMode()) {
case Mode.MESSAGE:
if (!(this.scene.ui.getHandler() as MessageUiHandler).pendingPrompt) {
return;
}
case Mode.TITLE:
case Mode.COMMAND:
case Mode.MODIFIER_SELECT:
this.scene.ui.setOverlayMode(Mode.MENU);
break;
case Mode.STARTER_SELECT:
this.buttonTouch();
break;
case Mode.MENU:
this.scene.ui.revertMode();
[Refactor][QoL] Game Audio + New Settings (#3527) * Changed how non-BGM are loaded into the game + moved into directories * some leftovers * Apply suggestions from code review Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Added setting for Field Volume + rewrote playSound() and updateSoundVolume() functions to reflect the new settings. * Main -> Beta (#3635) * Fixed issue with falsy issue within condition to get a stat for IV scanner * add fix setting code to prevent form/variant bug when default form/variant setting is wrong. in addition, that fix code include gender fix, so i revert old gender fix. update wrong log message. * [Hotfix] Fix Memory Mushroom not showing relearner moves (#3619) * Fix Memory Mushroom not showing relearner moves * Fix rollout test * Rewrite player faint logic in FaintPhase (#3614) * 867 runerigus sprite (#3629) cropped static frames, fixed cropped sprite set runerigus exp to use the shiny exp's animation verified all hex colors are unchanged - fixed ultra necrozma exp front variant swapped arrays. - xatu female eye color fix * [Bug] Preventing the MBH from being stolen in Endless (#3630) * Endless MBH Fix * add import * Revert "add import" This reverts commit 814a4059c2830e972c348d698259535e117850bf. * Revert "Endless MBH Fix" This reverts commit 8eb448130132ff9eed614a2ec576926814008df0. * removed newline --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: frutescens <info@laptop> * [Bug] Fix type-hints for immunity (#3620) * enable mock containers to be found by name * enable mock text to be found by name * add test coverage for type-hints Only for "immunity" and "status moves" * fix wrong message key of curse(ghost type) (#3631) Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> * [Hotfix] Steal-able Mini Black Hole Pt 2 (#3632) * Still have no idea where Eternatus is given the MBH.... * typedocs --------- Co-authored-by: frutescens <info@laptop> * [Hotfix] Abilities that prevent ATK drops no longer stop other stat drops (#3624) * Abilities that prevent ATK drops no longer stop other stat drops * Apply suggestions from code review Co-authored-by: Mumble <kimjoanne@protonmail.com> * Add `isNullOrUndefined()` utility function --------- * Grip Claw now shows the proper pokemon nickname (#3634) Co-authored-by: frutescens <info@laptop> --------- Co-authored-by: Opaque02 <66582645+Opaque02@users.noreply.github.com> Co-authored-by: KimJeongSun <leo@atlaslabs.ai> Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: cam <lrlrliwoo@gmail.com> Co-authored-by: Mumble <kimjoanne@protonmail.com> Co-authored-by: frutescens <info@laptop> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com> * [Bug] Preventing the MBH from being stolen in Endless (#3630) * Endless MBH Fix * add import * Revert "add import" This reverts commit 814a4059c2830e972c348d698259535e117850bf. * Revert "Endless MBH Fix" This reverts commit 8eb448130132ff9eed614a2ec576926814008df0. * removed newline --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: frutescens <info@laptop> * [Hotfix] Steal-able Mini Black Hole Pt 2 (#3632) * Still have no idea where Eternatus is given the MBH.... * typedocs --------- Co-authored-by: frutescens <info@laptop> * Deleted phases.ts (#3618) * Updated sound terms * Added space for localization * Update src/locales/ko/settings.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_TW/settings.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * Update src/locales/pt_BR/settings.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/zh_CN/settings.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * Update src/locales/de/settings.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/ko/settings.ts Co-authored-by: returntoice <dieandbecome@gmail.com> * Update src/locales/fr/settings.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/it/settings.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Include sound effects that were loaded in as BGM. * Removed stray placeholder localization --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Opaque02 <66582645+Opaque02@users.noreply.github.com> Co-authored-by: KimJeongSun <leo@atlaslabs.ai> Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: cam <lrlrliwoo@gmail.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: returntoice <dieandbecome@gmail.com> Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-08-25 16:40:14 +00:00
this.scene.playSound("ui/select");
break;
default:
return;
}
}
buttonCycleOption(button: Button): void {
[QoL][Feature] Hall of Fame + Run History (#3251) * Fixed SaveSessionData issue + Added loss details + removed Modifiers * Final changes * Updated code with the current repo + mode localization * Final touches before moving to a clean branch * Manual merging * Some more merging + updating * Fixed import * TypeDocs issues * Fixed relevant typedoc issues * Manual merge * More fixes * So many commits for so little * Localization Updates * Very barebones implementation of 'favorite' runs - not planning to implement any time soon though * menu-ui-handler.ts localizations * Update src/locales/ko/run-history-ui-handler.ts Thank you! Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * The German name for Squirtle is silly * Fixed Run-Entry Def * Commented out networking functionality * Commenting out network functionality pt2 * Update src/locales/pt_BR/menu-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/pt_BR/run-history-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/ko/menu-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_CN/menu-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/zh_CN/run-history-ui-handler.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/fr/menu-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/it/menu-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Fixed SaveSessionData issue + Added loss details + removed Modifiers * Final changes * Updated code with the current repo + mode localization * Final touches before moving to a clean branch * Manual merging * Some more merging + updating * Fixed import * TypeDocs issues * Fixed relevant typedoc issues * Manual merge * More fixes * So many commits for so little * Localization Updates * Very barebones implementation of 'favorite' runs - not planning to implement any time soon though * menu-ui-handler.ts localizations * Update src/locales/ko/run-history-ui-handler.ts Thank you! Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * The German name for Squirtle is silly * Fixed Run-Entry Def * Commented out networking functionality * Commenting out network functionality pt2 * Fixed cursor-close out freeze and replaced hall of fame background * Removed console.log * Fixed cursor freeze bug + changed hall of fame background * cursor freeze bug fix pt 2 * Revert "Disable egg gacha in rewards (#3304)" This reverts commit 3a87c8657fa8c65b306a7b7bc883a834002485c2. * Merging menu-ui-handler.ts * Merging phases.ts * Manual merge for game-data.ts * Manual merge locales/en/config.ts * Manual merge of menu-ui-handler.ts * Manual ui.ts merge * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Revert "Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into runHistoryNew" This reverts commit 5c6fcf6ec485ab0a967fd714d95928b04435a7ea, reversing changes made to 751bf4a43327118b24bc55cba3a5230f96eb6d27. * Revert "Revert "Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into runHistoryNew"" This reverts commit f6c3580ad096b587f9b30f5d0aeb4bc9d630f726. * Added ending art to victorious runs * Added darker overlay instead * Hall of Fame art * Actual BG Images * some bug fixing * some bug fixing p2 * some minor changes * some minor changes * Changed order of runs displayed to newest --> oldest * console.log for debugging * Export/Import Run History function * added import validation * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Felt coder's guilt for bad buttons implementation * strict-null changes * New Localizations * Update src/locales/fr/menu-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Apply suggestions from code review Thank you! Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Apply suggestions from code review run-info-ui-handler comments fix Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update src/locales/es/menu-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Update src/locales/es/menu-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Update src/locales/es/run-history-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> * Lost this file somehow * Added do not delete comments * Apply suggestions from code review Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * flx Changes * Localizations * Fixing Git test issues * Fixed issues found by Starkrieg * removed console log * Fixed cursor bugs * github pages issue * Update src/ui/run-info-ui-handler.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/ui/run-history-ui-handler.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Corrade's comments * The things I do for Github PAges * Preventing menu freeze * Double trainer battles and fresh start challenge * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/ko/menu-ui-handler.ts Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> * Update src/locales/pt_BR/run-history-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/pt_BR/menu-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/de/menu-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/de/run-history-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/it/menu-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Update src/locales/ko/run-history-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Apply suggestions from code review Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Localizations + Error Message Update Co-authored-by: protimita <protimitajp@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * small fixes * flx-sta suggestions + Localizations Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Update src/locales/it/run-history-ui-handler.ts Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Added dynamic text positioning based on container size + small fixes * Thanks Adri1 ! Quick Fix for localizing wave in RunInfo * Transfered defeat parsing to smaller functions and added page modes * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Run History UI handler documentation * Fixed rival names * some comments * Apply suggestions from code review Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Finished documentation * Fixed incorrect rival name handling * Corrected limit-handling * Update src/locales/fr/run-history-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Cleaned up getrunhistorydata() per flx-sta's suggestions * Added some override tags? * Added scopes/override notes to classes/class variables/class functions * Moved code from phases.ts to game-over-phase.ts * Fixing game-data whoops * ughhhhh * Update src/ui/run-history-ui-handler.ts Co-authored-by: Adrián T. <99520451+Vassiat@users.noreply.github.com> * Fixed cursor and updated money. Note - need to fix money handling for Asian languages * Money appears according to settings * typedocs blah blah * cleaning up manage data options * Final flx fixes + No Run History handling * Translation update. --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: sodam <66295123+sodaMelon@users.noreply.github.com> Co-authored-by: protimita <protimitajp@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: Adrián T. <99520451+Vassiat@users.noreply.github.com>
2024-08-23 18:23:16 +00:00
const whitelist = [StarterSelectUiHandler, SettingsUiHandler, RunInfoUiHandler, SettingsDisplayUiHandler, SettingsAudioUiHandler, SettingsGamepadUiHandler, SettingsKeyboardUiHandler];
const uiHandler = this.scene.ui?.getHandler();
if (whitelist.some(handler => uiHandler instanceof handler)) {
this.scene.ui.processInput(button);
} else if (button === Button.V) {
this.buttonInfo(true);
}
}
buttonSpeedChange(up = true): void {
2024-06-03 23:57:47 +00:00
const settingGameSpeed = settingIndex(SettingKeys.Game_Speed);
if (up && this.scene.gameSpeed < 5) {
2024-06-18 14:07:36 +00:00
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Setting[settingGameSpeed].options.findIndex((item) => item.label === `${this.scene.gameSpeed}x`) + 1);
2024-06-03 23:57:47 +00:00
if (this.scene.ui?.getMode() === Mode.SETTINGS) {
(this.scene.ui.getHandler() as SettingsUiHandler).show([]);
}
2024-06-03 23:57:47 +00:00
} else if (!up && this.scene.gameSpeed > 1) {
2024-06-18 14:07:36 +00:00
this.scene.gameData.saveSetting(SettingKeys.Game_Speed, Math.max(Setting[settingGameSpeed].options.findIndex((item) => item.label === `${this.scene.gameSpeed}x`) - 1, 0));
if (this.scene.ui?.getMode() === Mode.SETTINGS) {
(this.scene.ui.getHandler() as SettingsUiHandler).show([]);
}
}
}
}