mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 13:59:27 +02:00
Move asset initialization into preload
instead of launchBattle
This commit is contained in:
parent
a6e4459ecd
commit
91f9ededed
@ -392,9 +392,21 @@ export class BattleScene extends SceneBase {
|
||||
};
|
||||
}
|
||||
|
||||
populateAnims();
|
||||
/**
|
||||
* These moves serve as fallback animations for other moves without loaded animations, and
|
||||
* must be loaded prior to game start.
|
||||
*/
|
||||
const defaultMoves = [MoveId.TACKLE, MoveId.TAIL_WHIP, MoveId.FOCUS_ENERGY, MoveId.STRUGGLE];
|
||||
|
||||
await this.initVariantData();
|
||||
await Promise.all([
|
||||
populateAnims(),
|
||||
this.initVariantData(),
|
||||
initCommonAnims().then(() => loadCommonAnimAssets(true)),
|
||||
Promise.all(defaultMoves.map(m => initMoveAnim(m))).then(() => loadMoveAnimAssets(defaultMoves, true)),
|
||||
this.initStarterColors(),
|
||||
]).catch(reason => {
|
||||
throw new Error(`Unexpected error during BattleScene preLoad!\nReason: ${reason}`);
|
||||
});
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -596,8 +608,6 @@ export class BattleScene extends SceneBase {
|
||||
|
||||
this.party = [];
|
||||
|
||||
const loadPokemonAssets = [];
|
||||
|
||||
this.arenaPlayer = new ArenaBase(true);
|
||||
this.arenaPlayer.setName("arena-player");
|
||||
this.arenaPlayerTransition = new ArenaBase(true);
|
||||
@ -652,28 +662,15 @@ export class BattleScene extends SceneBase {
|
||||
|
||||
this.reset(false, false, true);
|
||||
|
||||
// Initialize UI-related aspects and then start the login phase.
|
||||
const ui = new UI();
|
||||
this.uiContainer.add(ui);
|
||||
|
||||
this.ui = ui;
|
||||
|
||||
ui.setup();
|
||||
|
||||
const defaultMoves = [MoveId.TACKLE, MoveId.TAIL_WHIP, MoveId.FOCUS_ENERGY, MoveId.STRUGGLE];
|
||||
|
||||
Promise.all([
|
||||
Promise.all(loadPokemonAssets),
|
||||
initCommonAnims().then(() => loadCommonAnimAssets(true)),
|
||||
Promise.all(
|
||||
[MoveId.TACKLE, MoveId.TAIL_WHIP, MoveId.FOCUS_ENERGY, MoveId.STRUGGLE].map(m => initMoveAnim(m)),
|
||||
).then(() => loadMoveAnimAssets(defaultMoves, true)),
|
||||
this.initStarterColors(),
|
||||
]).then(() => {
|
||||
this.phaseManager.pushNew("LoginPhase");
|
||||
this.phaseManager.pushNew("TitlePhase");
|
||||
|
||||
this.phaseManager.shiftPhase();
|
||||
});
|
||||
this.phaseManager.pushNew("LoginPhase");
|
||||
this.phaseManager.pushNew("TitlePhase");
|
||||
this.phaseManager.shiftPhase();
|
||||
}
|
||||
|
||||
initSession(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user