Show icon when saving data
This commit is contained in:
1 parent
aa421b5d10
commit
075db8ae0c
7 files changed
+92
-1
No files matched your search
@@ -223,9 +223,12 @@ export class GameData {
|
||||
|
||||
public saveSystem(): Promise<boolean> {
|
||||
return new Promise<boolean>(resolve => {
|
||||
this.scene.ui.savingIcon.show();
|
||||
updateUserInfo().then((success: boolean) => {
|
||||
if (!success)
|
||||
if (!success) {
|
||||
this.scene.ui.savingIcon.hide();
|
||||
return resolve(false);
|
||||
}
|
||||
const data: SystemSaveData = {
|
||||
trainerId: this.trainerId,
|
||||
secretId: this.secretId,
|
||||
@@ -250,6 +253,7 @@ export class GameData {
|
||||
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData)
|
||||
.then(response => response.text())
|
||||
.then(error => {
|
||||
this.scene.ui.savingIcon.hide();
|
||||
if (error) {
|
||||
console.error(error);
|
||||
return resolve(false);
|
||||
@@ -261,6 +265,8 @@ export class GameData {
|
||||
|
||||
localStorage.setItem('data', btoa(systemData));
|
||||
|
||||
this.scene.ui.savingIcon.hide();
|
||||
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user