offline - fixed continue button

pull/911/head
unknown 2024-05-15 11:33:45 -03:00
parent 512016faef
commit 135fa80d1f
2 changed files with 8 additions and 5 deletions

View File

@ -14,11 +14,10 @@ export function updateUserInfo(): Promise<[boolean, integer]> {
if (bypassLogin) {
loggedInUser = { username: 'Guest', lastSessionSlot: -1 };
let lastSessionSlot = -1;
for (let s = 0; s < 2; s++) {
if (localStorage.getItem(`sessionData${s ? s : ''}_${loggedInUser.username}`)) {
lastSessionSlot = s;
break;
}
// Get last slot saved and checks if it has data to enable continue
const slotId = parseInt(localStorage.getItem('slotId'));
if (localStorage.getItem(`sessionData${slotId ? slotId : ''}_${loggedInUser.username}`)) {
lastSessionSlot = slotId;
}
loggedInUser.lastSessionSlot = lastSessionSlot;
return resolve([ true, 200 ]);

View File

@ -751,6 +751,7 @@ export class GameData {
return new Promise<boolean>(resolve => {
if (bypassLogin) {
localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}_${loggedInUser.username}`);
updateUserInfo(); // Remove continue on session delete
return resolve(true);
}
@ -813,6 +814,7 @@ export class GameData {
return new Promise<[boolean, boolean]>(resolve => {
if (bypassLogin) {
localStorage.removeItem(`sessionData${slotId ? slotId : ''}_${loggedInUser.username}`);
updateUserInfo(); // Remove continue on clear
return resolve([true, true]);
}
@ -925,6 +927,8 @@ export class GameData {
});
} else {
this.verify().then(success => {
// Last slot saved for continue purposes
localStorage.setItem('slotId', scene.sessionSlotId.toString());
this.scene.ui.savingIcon.hide();
resolve(success);
});