mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-21 12:35:59 +02:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { Phase } from "#app/phase";
|
|
import { Mode } from "#app/ui/ui";
|
|
import type { 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[];
|
|
|
|
constructor(eggHatchData: EggHatchData[]) {
|
|
super();
|
|
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) {
|
|
globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
|
globalScene.fadeOutBgm(undefined, false);
|
|
});
|
|
|
|
} else {
|
|
this.eggHatchData[i].setDex();
|
|
this.eggHatchData[i].updatePokemon().then(() => {
|
|
if (i < this.eggHatchData.length) {
|
|
updateNextPokemon(i + 1);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
updateNextPokemon(0);
|
|
|
|
}
|
|
|
|
end() {
|
|
globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true));
|
|
globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {
|
|
super.end();
|
|
});
|
|
}
|
|
}
|