mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-27 20:20:43 +00:00
- remove any `.js` extension imports - remove unncessary dynamic imports of `modifier.ts` file. The file was being imported statically & dynamically. Made it pure static - increase vite chunk-size warning limit Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
40 lines
935 B
TypeScript
40 lines
935 B
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { Phase } from "#app/phase";
|
|
import { Mode } from "#app/ui/ui";
|
|
import * as Utils from "#app/utils";
|
|
|
|
export class ReloadSessionPhase extends Phase {
|
|
private systemDataStr: string | null;
|
|
|
|
constructor(scene: BattleScene, systemDataStr?: string) {
|
|
super(scene);
|
|
|
|
this.systemDataStr = systemDataStr ?? null;
|
|
}
|
|
|
|
start(): void {
|
|
this.scene.ui.setMode(Mode.SESSION_RELOAD);
|
|
|
|
let delayElapsed = false;
|
|
let loaded = false;
|
|
|
|
this.scene.time.delayedCall(Utils.fixedInt(1500), () => {
|
|
if (loaded) {
|
|
this.end();
|
|
} else {
|
|
delayElapsed = true;
|
|
}
|
|
});
|
|
|
|
this.scene.gameData.clearLocalData();
|
|
|
|
(this.systemDataStr ? this.scene.gameData.initSystem(this.systemDataStr) : this.scene.gameData.loadSystem()).then(() => {
|
|
if (delayElapsed) {
|
|
this.end();
|
|
} else {
|
|
loaded = true;
|
|
}
|
|
});
|
|
}
|
|
}
|