[Performance] [Refactor] [UI/UX] Cleanup egg gacha UI, Speed Up Machines (#5889)

* Convert egg gacha type into an object literal

* Refactor egg gacha ui handler

* Apply kev's suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Condense Object.freeze inside of gacha-type.ts

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Sirz Benjie 2025-07-11 11:38:35 -06:00 committed by GitHub
parent 9958e4fe13
commit bc45869912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 483 additions and 456 deletions

View File

@ -1,5 +1,7 @@
export enum GachaType {
MOVE,
LEGENDARY,
SHINY
}
export const GachaType = Object.freeze({
MOVE: 0,
LEGENDARY: 1,
SHINY: 2
});
export type GachaType = typeof GachaType[keyof typeof GachaType];

View File

@ -4,7 +4,7 @@ import CacheBustedLoaderPlugin from "#app/plugins/cache-busted-loader-plugin";
import { SceneBase } from "#app/scene-base";
import { WindowVariant, getWindowVariantSuffix } from "#app/ui/ui-theme";
import { isMobile } from "#app/touch-controls";
import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils/common";
import { localPing, getEnumValues, hasAllLocalizedSprites } from "#app/utils/common";
import { initPokemonPrevolutions, initPokemonStarters } from "#app/data/balance/pokemon-evolutions";
import { initBiomes } from "#app/data/balance/biomes";
import { initEggMoves } from "#app/data/balance/egg-moves";
@ -270,7 +270,7 @@ export class LoadingScene extends SceneBase {
this.loadAtlas("egg_icons", "egg");
this.loadAtlas("egg_shard", "egg");
this.loadAtlas("egg_lightrays", "egg");
for (const gt of getEnumKeys(GachaType)) {
for (const gt of Object.keys(GachaType)) {
const key = gt.toLowerCase();
this.loadImage(`gacha_${key}`, "egg");
this.loadAtlas(`gacha_underlay_${key}`, "egg");

File diff suppressed because it is too large Load Diff