Fix save data not loading on login
This commit is contained in:
parent
ac456fc5ba
commit
550c65d6f5
|
@ -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.ui.showText('Log in or create an account to start. No email required!');
|
||||||
|
|
||||||
this.scene.playSound('menu_open');
|
this.scene.playSound('menu_open');
|
||||||
|
|
||||||
|
const loadData = () => {
|
||||||
|
this.scene.gameData.loadSystem().then(() => this.end());
|
||||||
|
};
|
||||||
|
|
||||||
this.scene.ui.setMode(Mode.LOGIN_FORM, {
|
this.scene.ui.setMode(Mode.LOGIN_FORM, {
|
||||||
buttonActions: [
|
buttonActions: [
|
||||||
() => {
|
() => {
|
||||||
this.scene.ui.playSelect();
|
this.scene.ui.playSelect();
|
||||||
this.end();
|
loadData();
|
||||||
}, () => {
|
}, () => {
|
||||||
this.scene.playSound('menu_open');
|
this.scene.playSound('menu_open');
|
||||||
this.scene.ui.setMode(Mode.REGISTRATION_FORM, {
|
this.scene.ui.setMode(Mode.REGISTRATION_FORM, {
|
||||||
buttonActions: [
|
buttonActions: [
|
||||||
() => {
|
() => {
|
||||||
this.scene.ui.playSelect();
|
this.scene.ui.playSelect();
|
||||||
this.end();
|
loadData();
|
||||||
}, () => {
|
}, () => {
|
||||||
this.scene.unshiftPhase(new LoginPhase(this.scene, false));
|
this.scene.unshiftPhase(new LoginPhase(this.scene, false));
|
||||||
this.end();
|
this.end();
|
||||||
|
|
|
@ -220,7 +220,7 @@ export class GameData {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadSystem(): Promise<boolean> {
|
public loadSystem(): Promise<boolean> {
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
if (bypassLogin && !localStorage.hasOwnProperty('data'))
|
if (bypassLogin && !localStorage.hasOwnProperty('data'))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue