mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Add local data clears where applicable
This commit is contained in:
parent
9a965055b1
commit
7c45da4a01
@ -414,6 +414,8 @@ export class ReloadSessionPhase extends Phase {
|
|||||||
delayElapsed = true;
|
delayElapsed = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.scene.gameData.clearLocalData();
|
||||||
|
|
||||||
(this.systemDataStr ? this.scene.gameData.initSystem(this.systemDataStr) : this.scene.gameData.loadSystem()).then(() => {
|
(this.systemDataStr ? this.scene.gameData.initSystem(this.systemDataStr) : this.scene.gameData.loadSystem()).then(() => {
|
||||||
if (delayElapsed)
|
if (delayElapsed)
|
||||||
this.end();
|
this.end();
|
||||||
|
@ -359,11 +359,8 @@ export class GameData {
|
|||||||
if (cachedSystemData.timestamp > systemData.timestamp) {
|
if (cachedSystemData.timestamp > systemData.timestamp) {
|
||||||
console.debug('Use cached system');
|
console.debug('Use cached system');
|
||||||
systemData = cachedSystemData;
|
systemData = cachedSystemData;
|
||||||
} else {
|
} else
|
||||||
localStorage.removeItem(`data_${loggedInUser.username}`);
|
this.clearLocalData();
|
||||||
for (let s = 0; s < 5; s++)
|
|
||||||
localStorage.removeItem(`sessionData${s ? s : ''}_${loggedInUser.username}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug(systemData);
|
console.debug(systemData);
|
||||||
@ -512,15 +509,19 @@ export class GameData {
|
|||||||
if (!response.valid) {
|
if (!response.valid) {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene, JSON.stringify(response.systemData)));
|
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene, JSON.stringify(response.systemData)));
|
||||||
localStorage.removeItem(`data_${loggedInUser.username}`);
|
this.clearLocalData();
|
||||||
for (let s = 0; s < 5; s++)
|
|
||||||
localStorage.removeItem(`sessionData${s ? s : ''}_${loggedInUser.username}`);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clearLocalData(): void {
|
||||||
|
localStorage.removeItem(`data_${loggedInUser.username}`);
|
||||||
|
for (let s = 0; s < 5; s++)
|
||||||
|
localStorage.removeItem(`sessionData${s ? s : ''}_${loggedInUser.username}`);
|
||||||
|
}
|
||||||
|
|
||||||
public saveSetting(setting: Setting, valueIndex: integer): boolean {
|
public saveSetting(setting: Setting, valueIndex: integer): boolean {
|
||||||
let settings: object = {};
|
let settings: object = {};
|
||||||
if (localStorage.hasOwnProperty('settings'))
|
if (localStorage.hasOwnProperty('settings'))
|
||||||
|
Loading…
Reference in New Issue
Block a user