mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 06:53:27 +02:00
Moved and renamed some ui files
This commit is contained in:
parent
df223bfbc8
commit
ddca519f96
@ -11,7 +11,7 @@ import type { EggLapsePhase } from "#phases/egg-lapse-phase";
|
||||
import { achvs } from "#system/achv";
|
||||
import { EggCounterContainer } from "#ui/containers/egg-counter-container";
|
||||
import { PokemonInfoContainer } from "#ui/containers/pokemon-info-container";
|
||||
import type { EggHatchSceneHandler } from "#ui/handlers/egg-hatch-scene-handler";
|
||||
import type { EggHatchSceneUiHandler } from "#ui/handlers/egg-hatch-scene-ui-handler";
|
||||
import { fixedInt, getFrameMs, randInt } from "#utils/common";
|
||||
import i18next from "i18next";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
@ -32,7 +32,7 @@ export class EggHatchPhase extends Phase {
|
||||
private eggCounterContainer: EggCounterContainer;
|
||||
|
||||
/** The scene handler for egg hatching */
|
||||
private eggHatchHandler: EggHatchSceneHandler;
|
||||
private eggHatchHandler: EggHatchSceneUiHandler;
|
||||
/** The phaser gameobject container that holds everything */
|
||||
private eggHatchContainer: Phaser.GameObjects.Container;
|
||||
/** The phaser image that is the background */
|
||||
@ -92,7 +92,7 @@ export class EggHatchPhase extends Phase {
|
||||
|
||||
globalScene.fadeOutBgm(undefined, false);
|
||||
|
||||
this.eggHatchHandler = globalScene.ui.getHandler() as EggHatchSceneHandler;
|
||||
this.eggHatchHandler = globalScene.ui.getHandler() as EggHatchSceneUiHandler;
|
||||
|
||||
this.eggHatchContainer = this.eggHatchHandler.eggHatchContainer;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import { LearnMoveSituation } from "#enums/learn-move-situation";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { cos, sin } from "#field/anims";
|
||||
import type { PlayerPokemon, Pokemon } from "#field/pokemon";
|
||||
import type { EvolutionSceneHandler } from "#ui/handlers/evolution-scene-handler";
|
||||
import type { EvolutionSceneUiHandler } from "#ui/handlers/evolution-scene-ui-handler";
|
||||
import { fixedInt, getFrameMs, randInt } from "#utils/common";
|
||||
import i18next from "i18next";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
@ -29,7 +29,7 @@ export class EvolutionPhase extends Phase {
|
||||
private evolution: SpeciesFormEvolution | null;
|
||||
private fusionSpeciesEvolved: boolean; // Whether the evolution is of the fused species
|
||||
private evolutionBgm: AnySound | null;
|
||||
private evolutionHandler: EvolutionSceneHandler;
|
||||
private evolutionHandler: EvolutionSceneUiHandler;
|
||||
|
||||
/** Container for all assets used by the scene. When the scene is cleared, the children within this are destroyed. */
|
||||
protected evolutionContainer: Phaser.GameObjects.Container;
|
||||
@ -79,7 +79,7 @@ export class EvolutionPhase extends Phase {
|
||||
*
|
||||
*/
|
||||
private setupEvolutionAssets(): void {
|
||||
this.evolutionHandler = globalScene.ui.getHandler() as EvolutionSceneHandler;
|
||||
this.evolutionHandler = globalScene.ui.getHandler() as EvolutionSceneUiHandler;
|
||||
this.evolutionContainer = this.evolutionHandler.evolutionContainer;
|
||||
this.evolutionBaseBg = globalScene.add.image(0, 0, "default_bg").setOrigin(0);
|
||||
|
||||
|
@ -10,7 +10,7 @@ import { UiMode } from "#enums/ui-mode";
|
||||
import type { Pokemon } from "#field/pokemon";
|
||||
import type { Move } from "#moves/move";
|
||||
import { PlayerPartyMemberPokemonPhase } from "#phases/player-party-member-pokemon-phase";
|
||||
import { EvolutionSceneHandler } from "#ui/handlers/evolution-scene-handler";
|
||||
import { EvolutionSceneUiHandler } from "#ui/handlers/evolution-scene-ui-handler";
|
||||
import { SummaryUiMode } from "#ui/handlers/summary-ui-handler";
|
||||
import i18next from "i18next";
|
||||
|
||||
@ -47,7 +47,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
}
|
||||
|
||||
this.messageMode =
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? UiMode.EVOLUTION_SCENE : UiMode.MESSAGE;
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneUiHandler ? UiMode.EVOLUTION_SCENE : UiMode.MESSAGE;
|
||||
globalScene.ui.setMode(this.messageMode);
|
||||
// If the Pokemon has less than 4 moves, the new move is added to the largest empty moveset index
|
||||
// If it has 4 moves, the phase then checks if the player wants to replace the move itself.
|
||||
|
@ -3,8 +3,8 @@ 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 { PokedexPageUiHandler } from "#ui/containers/pokedex-page-ui-handler";
|
||||
import type { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokedexPageUiHandler } from "#ui/handlers/pokedex-page-ui-handler";
|
||||
import { PokedexUiHandler } from "#ui/handlers/pokedex-ui-handler";
|
||||
import { RunInfoUiHandler } from "#ui/handlers/run-info-ui-handler";
|
||||
import { StarterSelectUiHandler } from "#ui/handlers/starter-select-ui-handler";
|
||||
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import type { EggCountChangedEvent } from "#events/egg";
|
||||
import { EggEventType } from "#events/egg";
|
||||
import type { EggHatchSceneHandler } from "#ui/handlers/egg-hatch-scene-handler";
|
||||
import type { EggHatchSceneUiHandler } from "#ui/handlers/egg-hatch-scene-ui-handler";
|
||||
import { addTextObject } from "#ui/text";
|
||||
import { addWindow } from "#ui/ui-theme";
|
||||
|
||||
@ -27,7 +27,7 @@ export class EggCounterContainer extends Phaser.GameObjects.Container {
|
||||
super(globalScene, 0, 0);
|
||||
this.eggCount = eggCount;
|
||||
|
||||
const uiHandler = globalScene.ui.getHandler() as EggHatchSceneHandler;
|
||||
const uiHandler = globalScene.ui.getHandler() as EggHatchSceneUiHandler;
|
||||
|
||||
uiHandler.eventTarget.addEventListener(EggEventType.EGG_COUNT_CHANGED, this.onEggCountChangedEvent);
|
||||
this.setup();
|
||||
|
@ -4,8 +4,8 @@ import { Gender } from "#data/gender";
|
||||
import type { PokemonSpecies } from "#data/pokemon-species";
|
||||
import { DexAttr } from "#enums/dex-attr";
|
||||
import { getVariantTint } from "#sprites/variant";
|
||||
import type { PokemonIconAnimHandler } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import type { PokemonIconAnimHandler } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
|
||||
/**
|
||||
* A container for a Pokemon's sprite and icons to get displayed in the egg summary screen
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { fixedInt } from "#utils/common";
|
||||
|
||||
export class SavingIconHandler extends Phaser.GameObjects.Container {
|
||||
export class SavingIconContainer extends Phaser.GameObjects.Container {
|
||||
private icon: Phaser.GameObjects.Sprite;
|
||||
|
||||
private animActive: boolean;
|
||||
|
@ -3,7 +3,7 @@ import { Button } from "#enums/buttons";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { UiHandler } from "#ui/handlers/ui-handler";
|
||||
|
||||
export class EggHatchSceneHandler extends UiHandler {
|
||||
export class EggHatchSceneUiHandler extends UiHandler {
|
||||
public eggHatchContainer: Phaser.GameObjects.Container;
|
||||
|
||||
/**
|
@ -4,10 +4,10 @@ import { TextStyle } from "#enums/text-style";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { ScrollBar } from "#ui/containers/scroll-bar";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { ScrollableGridUiHandler } from "#ui/handlers/scrollable-grid-handler";
|
||||
import { addTextObject } from "#ui/text";
|
||||
import { addWindow } from "#ui/ui-theme";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { ScrollableGridHandler } from "#ui/utils/scrollable-grid-handler";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class EggListUiHandler extends MessageUiHandler {
|
||||
@ -25,7 +25,7 @@ export class EggListUiHandler extends MessageUiHandler {
|
||||
private eggListMessageBoxContainer: Phaser.GameObjects.Container;
|
||||
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
private scrollGridHandler: ScrollableGridUiHandler;
|
||||
private scrollGridHandler: ScrollableGridHandler;
|
||||
|
||||
private iconAnimHandler: PokemonIconAnimHandler;
|
||||
|
||||
@ -64,7 +64,7 @@ export class EggListUiHandler extends MessageUiHandler {
|
||||
|
||||
const scrollBar = new ScrollBar(310, 5, 4, 170, this.ROWS);
|
||||
|
||||
this.scrollGridHandler = new ScrollableGridUiHandler(this, this.ROWS, this.COLUMNS)
|
||||
this.scrollGridHandler = new ScrollableGridHandler(this, this.ROWS, this.COLUMNS)
|
||||
.withScrollBar(scrollBar)
|
||||
.withUpdateGridCallBack(() => this.updateEggIcons())
|
||||
.withUpdateSingleElementCallback((i: number) => this.setEggDetails(i));
|
||||
|
@ -7,8 +7,8 @@ import { HatchedPokemonContainer } from "#ui/containers/hatched-pokemon-containe
|
||||
import { PokemonHatchInfoContainer } from "#ui/containers/pokemon-hatch-info-container";
|
||||
import { ScrollBar } from "#ui/containers/scroll-bar";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { ScrollableGridUiHandler } from "#ui/handlers/scrollable-grid-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { ScrollableGridHandler } from "#ui/utils/scrollable-grid-handler";
|
||||
|
||||
const iconContainerX = 112;
|
||||
const iconContainerY = 9;
|
||||
@ -38,7 +38,7 @@ export class EggSummaryUiHandler extends MessageUiHandler {
|
||||
private eggHatchBg: Phaser.GameObjects.Image;
|
||||
private eggHatchData: EggHatchData[];
|
||||
|
||||
private scrollGridHandler: ScrollableGridUiHandler;
|
||||
private scrollGridHandler: ScrollableGridHandler;
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
|
||||
/** used to add a delay before which it is not possible to exit the summary */
|
||||
@ -97,7 +97,7 @@ export class EggSummaryUiHandler extends MessageUiHandler {
|
||||
);
|
||||
this.summaryContainer.add(scrollBar);
|
||||
|
||||
this.scrollGridHandler = new ScrollableGridUiHandler(this, numRows, numCols)
|
||||
this.scrollGridHandler = new ScrollableGridHandler(this, numRows, numCols)
|
||||
.withScrollBar(scrollBar)
|
||||
.withUpdateGridCallBack(() => this.updatePokemonIcons())
|
||||
.withUpdateSingleElementCallback((i: number) => this.infoContainer.showHatchInfo(this.eggHatchData[i]));
|
||||
|
@ -5,7 +5,7 @@ import { UiMode } from "#enums/ui-mode";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { addTextObject } from "#ui/text";
|
||||
|
||||
export class EvolutionSceneHandler extends MessageUiHandler {
|
||||
export class EvolutionSceneUiHandler extends MessageUiHandler {
|
||||
public evolutionContainer: Phaser.GameObjects.Container;
|
||||
public messageBg: Phaser.GameObjects.Image;
|
||||
public messageContainer: Phaser.GameObjects.Container;
|
@ -23,9 +23,9 @@ import { getVariantTint } from "#sprites/variant";
|
||||
import type { TurnMove } from "#types/turn-move";
|
||||
import { MoveInfoOverlay } from "#ui/containers/move-info-overlay";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text";
|
||||
import { addWindow } from "#ui/ui-theme";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { applyChallenges } from "#utils/challenge-utils";
|
||||
import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common";
|
||||
import { toCamelCase, toTitleCase } from "#utils/strings";
|
||||
|
@ -48,9 +48,9 @@ import { PokedexMonContainer } from "#ui/containers/pokedex-mon-container";
|
||||
import { ScrollBar } from "#ui/containers/scroll-bar";
|
||||
import type { OptionSelectConfig } from "#ui/handlers/abstract-option-select-ui-handler";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { addTextObject, getTextColor } from "#ui/text";
|
||||
import { addWindow } from "#ui/ui-theme";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { BooleanHolder, fixedInt, getLocalizedSpriteKey, padInt, randIntRange, rgbHexToRgba } from "#utils/common";
|
||||
import type { StarterPreferences } from "#utils/data";
|
||||
import { loadStarterPreferences } from "#utils/data";
|
||||
|
@ -65,9 +65,9 @@ import { StarterContainer } from "#ui/containers/starter-container";
|
||||
import { StatsContainer } from "#ui/containers/stats-container";
|
||||
import type { OptionSelectItem } from "#ui/handlers/abstract-option-select-ui-handler";
|
||||
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/handlers/pokemon-icon-anim-handler";
|
||||
import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text";
|
||||
import { addWindow } from "#ui/ui-theme";
|
||||
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/utils/pokemon-icon-anim-handler";
|
||||
import { applyChallenges, checkStarterValidForChallenge } from "#utils/challenge-utils";
|
||||
import {
|
||||
BooleanHolder,
|
||||
|
16
src/ui/ui.ts
16
src/ui/ui.ts
@ -6,8 +6,7 @@ import { TextStyle } from "#enums/text-style";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { AchvBar } from "#ui/containers/achv-bar";
|
||||
import type { BgmBar } from "#ui/containers/bgm-bar";
|
||||
import { PokedexPageUiHandler } from "#ui/containers/pokedex-page-ui-handler";
|
||||
import { SavingIconHandler } from "#ui/containers/saving-icon-handler";
|
||||
import { SavingIconContainer } from "#ui/containers/saving-icon-handler";
|
||||
import { GamepadBindingUiHandler } from "#ui/gamepad-binding-ui-handler";
|
||||
import { AchvsUiHandler } from "#ui/handlers/achvs-ui-handler";
|
||||
import { AutoCompleteUiHandler } from "#ui/handlers/autocomplete-ui-handler";
|
||||
@ -19,10 +18,10 @@ import { ChangePasswordFormUiHandler } from "#ui/handlers/change-password-form-u
|
||||
import { CommandUiHandler } from "#ui/handlers/command-ui-handler";
|
||||
import { ConfirmUiHandler } from "#ui/handlers/confirm-ui-handler";
|
||||
import { EggGachaUiHandler } from "#ui/handlers/egg-gacha-ui-handler";
|
||||
import { EggHatchSceneHandler } from "#ui/handlers/egg-hatch-scene-handler";
|
||||
import { EggHatchSceneUiHandler } from "#ui/handlers/egg-hatch-scene-ui-handler";
|
||||
import { EggListUiHandler } from "#ui/handlers/egg-list-ui-handler";
|
||||
import { EggSummaryUiHandler } from "#ui/handlers/egg-summary-ui-handler";
|
||||
import { EvolutionSceneHandler } from "#ui/handlers/evolution-scene-handler";
|
||||
import { EvolutionSceneUiHandler } from "#ui/handlers/evolution-scene-ui-handler";
|
||||
import { FightUiHandler } from "#ui/handlers/fight-ui-handler";
|
||||
import { GameStatsUiHandler } from "#ui/handlers/game-stats-ui-handler";
|
||||
import { LoadingModalUiHandler } from "#ui/handlers/loading-modal-ui-handler";
|
||||
@ -32,6 +31,7 @@ import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
|
||||
import { ModifierSelectUiHandler } from "#ui/handlers/modifier-select-ui-handler";
|
||||
import { MysteryEncounterUiHandler } from "#ui/handlers/mystery-encounter-ui-handler";
|
||||
import { PartyUiHandler } from "#ui/handlers/party-ui-handler";
|
||||
import { PokedexPageUiHandler } from "#ui/handlers/pokedex-page-ui-handler";
|
||||
import { PokedexScanUiHandler } from "#ui/handlers/pokedex-scan-ui-handler";
|
||||
import { PokedexUiHandler } from "#ui/handlers/pokedex-ui-handler";
|
||||
import { RegistrationFormUiHandler } from "#ui/handlers/registration-form-ui-handler";
|
||||
@ -115,7 +115,7 @@ export class UI extends Phaser.GameObjects.Container {
|
||||
private overlay: Phaser.GameObjects.Rectangle;
|
||||
public achvBar: AchvBar;
|
||||
public bgmBar: BgmBar;
|
||||
public savingIcon: SavingIconHandler;
|
||||
public savingIcon: SavingIconContainer;
|
||||
|
||||
private tooltipContainer: Phaser.GameObjects.Container;
|
||||
private tooltipBg: Phaser.GameObjects.NineSlice;
|
||||
@ -141,8 +141,8 @@ export class UI extends Phaser.GameObjects.Container {
|
||||
new PartyUiHandler(),
|
||||
new SummaryUiHandler(),
|
||||
new StarterSelectUiHandler(),
|
||||
new EvolutionSceneHandler(),
|
||||
new EggHatchSceneHandler(),
|
||||
new EvolutionSceneUiHandler(),
|
||||
new EggHatchSceneUiHandler(),
|
||||
new EggSummaryUiHandler(),
|
||||
new ConfirmUiHandler(),
|
||||
new OptionSelectUiHandler(),
|
||||
@ -198,7 +198,7 @@ export class UI extends Phaser.GameObjects.Container {
|
||||
|
||||
globalScene.uiContainer.add(this.achvBar);
|
||||
|
||||
this.savingIcon = new SavingIconHandler();
|
||||
this.savingIcon = new SavingIconContainer();
|
||||
this.savingIcon.setup();
|
||||
|
||||
globalScene.uiContainer.add(this.savingIcon);
|
||||
|
@ -16,7 +16,7 @@ type UpdateDetailsCallbackFunction = (index: number) => void;
|
||||
* - in `UiHandler.processInput`: call `processNavigationInput` to have it handle the cursor updates while calling the defined callbacks
|
||||
* - in `UiHandler.clear`: call `reset`
|
||||
*/
|
||||
export class ScrollableGridUiHandler {
|
||||
export class ScrollableGridHandler {
|
||||
private readonly ROWS: number;
|
||||
private readonly COLUMNS: number;
|
||||
private handler: UiHandler;
|
||||
@ -47,7 +47,7 @@ export class ScrollableGridUiHandler {
|
||||
* @param scrollBar {@linkcode ScrollBar}
|
||||
* @returns this
|
||||
*/
|
||||
withScrollBar(scrollBar: ScrollBar): ScrollableGridUiHandler {
|
||||
withScrollBar(scrollBar: ScrollBar): ScrollableGridHandler {
|
||||
this.scrollBar = scrollBar;
|
||||
this.scrollBar.setTotalRows(Math.ceil(this.totalElements / this.COLUMNS));
|
||||
return this;
|
||||
@ -58,7 +58,7 @@ export class ScrollableGridUiHandler {
|
||||
* @param callback {@linkcode UpdateGridCallbackFunction}
|
||||
* @returns this
|
||||
*/
|
||||
withUpdateGridCallBack(callback: UpdateGridCallbackFunction): ScrollableGridUiHandler {
|
||||
withUpdateGridCallBack(callback: UpdateGridCallbackFunction): ScrollableGridHandler {
|
||||
this.updateGridCallback = callback;
|
||||
return this;
|
||||
}
|
||||
@ -68,7 +68,7 @@ export class ScrollableGridUiHandler {
|
||||
* @param callback {@linkcode UpdateDetailsCallbackFunction}
|
||||
* @returns this
|
||||
*/
|
||||
withUpdateSingleElementCallback(callback: UpdateDetailsCallbackFunction): ScrollableGridUiHandler {
|
||||
withUpdateSingleElementCallback(callback: UpdateDetailsCallbackFunction): ScrollableGridHandler {
|
||||
this.updateDetailsCallback = callback;
|
||||
return this;
|
||||
}
|
@ -9,7 +9,7 @@ import { UiMode } from "#enums/ui-mode";
|
||||
import type { StarterAttributes } from "#system/game-data";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import { FilterTextRow } from "#ui/containers/filter-text";
|
||||
import { PokedexPageUiHandler } from "#ui/containers/pokedex-page-ui-handler";
|
||||
import { PokedexPageUiHandler } from "#ui/handlers/pokedex-page-ui-handler";
|
||||
import { PokedexUiHandler } from "#ui/handlers/pokedex-ui-handler";
|
||||
import { getPokemonSpecies } from "#utils/pokemon-utils";
|
||||
import Phaser from "phaser";
|
||||
|
Loading…
Reference in New Issue
Block a user