mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 21:12:45 +02:00
* cherry picked commits / manual copy * better dex tracking for summary after regular egg hatching * ui changes * updated egg hatch bg, added candy tracker, icon anims for new shiny or new form unlock * added i18 line, reset overrides * touchup * code cleanup, documentation and slight refactor * sprite display fix * load interrupts, simple sfx and no summary for small egg amounts * Garbage Collection + Eslint/Docs approved. * time logging and optimisation * skip redundant load * more time logs and fix pre-load issues * more detailed loading logs * changed loading to be on demand from cursor nav * fix missing variant icon fallback * removing redundant time logs and code touchup * code cleanup * Comments so developer doesn't get bugged about garbage collecton * remove logs n stuff * lang settings touchup and final touchup plus uploading blank egg summary bg * fix nits, js imports, extra docs, magic numbers changed * extra docs and spacing nits * Update Github --------- Co-authored-by: James Diefenbach <z5421232@ad.unsw.edu.au> Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: frutescens <info@laptop> Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { Phase } from "#app/phase";
|
|
import { Mode } from "#app/ui/ui";
|
|
import EggHatchSceneHandler from "#app/ui/egg-hatch-scene-handler";
|
|
import { EggHatchData } from "#app/data/egg-hatch-data";
|
|
|
|
/**
|
|
* Class that represents the egg summary phase
|
|
* It does some of the function for updating egg data
|
|
* Phase is handled mostly by the egg-hatch-scene-handler UI
|
|
*/
|
|
export class EggSummaryPhase extends Phase {
|
|
private eggHatchData: EggHatchData[];
|
|
private eggHatchHandler: EggHatchSceneHandler;
|
|
|
|
constructor(scene: BattleScene, eggHatchData: EggHatchData[]) {
|
|
super(scene);
|
|
this.eggHatchData = eggHatchData;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
// updates next pokemon once the current update has been completed
|
|
const updateNextPokemon = (i: number) => {
|
|
if (i >= this.eggHatchData.length) {
|
|
this.scene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
|
this.scene.fadeOutBgm(undefined, false);
|
|
this.eggHatchHandler = this.scene.ui.getHandler() as EggHatchSceneHandler;
|
|
});
|
|
|
|
} else {
|
|
this.eggHatchData[i].setDex();
|
|
this.eggHatchData[i].updatePokemon().then(() => {
|
|
if (i < this.eggHatchData.length) {
|
|
updateNextPokemon(i + 1);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
updateNextPokemon(0);
|
|
|
|
}
|
|
|
|
end() {
|
|
this.eggHatchHandler.clear();
|
|
this.scene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {});
|
|
super.end();
|
|
}
|
|
}
|