diff --git a/src/battle-phases.ts b/src/battle-phases.ts index e1da7928c..c4d3513f8 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -69,19 +69,23 @@ export class LoginPhase extends BattlePhase { this.scene.ui.showText('Log in or create an account to start. No email required!'); this.scene.playSound('menu_open'); + + const loadData = () => { + this.scene.gameData.loadSystem().then(() => this.end()); + }; this.scene.ui.setMode(Mode.LOGIN_FORM, { buttonActions: [ () => { this.scene.ui.playSelect(); - this.end(); + loadData(); }, () => { this.scene.playSound('menu_open'); this.scene.ui.setMode(Mode.REGISTRATION_FORM, { buttonActions: [ () => { this.scene.ui.playSelect(); - this.end(); + loadData(); }, () => { this.scene.unshiftPhase(new LoginPhase(this.scene, false)); this.end(); diff --git a/src/system/game-data.ts b/src/system/game-data.ts index b9596744e..5f0b3b85c 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -220,7 +220,7 @@ export class GameData { }); } - private loadSystem(): Promise { + public loadSystem(): Promise { return new Promise(resolve => { if (bypassLogin && !localStorage.hasOwnProperty('data')) return false;