mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-06 08:07:42 +00:00
* console logs n stuff * fix bad ui transition for egg summary freeze bug (logs included) * cleanup egg lapse phase * touchup * add back removed whitespace * remove console logs --------- Co-authored-by: James Diefenbach <z5421232@ad.unsw.edu.au>
52 lines
1.5 KiB
TypeScript
52 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.scene.time.delayedCall(250, () => this.scene.setModifiersVisible(true));
|
|
this.scene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {
|
|
super.end();
|
|
});
|
|
}
|
|
}
|