offline - fixed continue button
parent
512016faef
commit
135fa80d1f
|
@ -14,11 +14,10 @@ export function updateUserInfo(): Promise<[boolean, integer]> {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
loggedInUser = { username: 'Guest', lastSessionSlot: -1 };
|
loggedInUser = { username: 'Guest', lastSessionSlot: -1 };
|
||||||
let lastSessionSlot = -1;
|
let lastSessionSlot = -1;
|
||||||
for (let s = 0; s < 2; s++) {
|
// Get last slot saved and checks if it has data to enable continue
|
||||||
if (localStorage.getItem(`sessionData${s ? s : ''}_${loggedInUser.username}`)) {
|
const slotId = parseInt(localStorage.getItem('slotId'));
|
||||||
lastSessionSlot = s;
|
if (localStorage.getItem(`sessionData${slotId ? slotId : ''}_${loggedInUser.username}`)) {
|
||||||
break;
|
lastSessionSlot = slotId;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loggedInUser.lastSessionSlot = lastSessionSlot;
|
loggedInUser.lastSessionSlot = lastSessionSlot;
|
||||||
return resolve([ true, 200 ]);
|
return resolve([ true, 200 ]);
|
||||||
|
|
|
@ -751,6 +751,7 @@ export class GameData {
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}_${loggedInUser.username}`);
|
localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}_${loggedInUser.username}`);
|
||||||
|
updateUserInfo(); // Remove continue on session delete
|
||||||
return resolve(true);
|
return resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,6 +814,7 @@ export class GameData {
|
||||||
return new Promise<[boolean, boolean]>(resolve => {
|
return new Promise<[boolean, boolean]>(resolve => {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
localStorage.removeItem(`sessionData${slotId ? slotId : ''}_${loggedInUser.username}`);
|
localStorage.removeItem(`sessionData${slotId ? slotId : ''}_${loggedInUser.username}`);
|
||||||
|
updateUserInfo(); // Remove continue on clear
|
||||||
return resolve([true, true]);
|
return resolve([true, true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,6 +927,8 @@ export class GameData {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.verify().then(success => {
|
this.verify().then(success => {
|
||||||
|
// Last slot saved for continue purposes
|
||||||
|
localStorage.setItem('slotId', scene.sessionSlotId.toString());
|
||||||
this.scene.ui.savingIcon.hide();
|
this.scene.ui.savingIcon.hide();
|
||||||
resolve(success);
|
resolve(success);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue