1
0
Fork 0

Add waiting dialog while loading game from network

This commit is contained in:
Michaël Lemaire 2017-07-20 17:32:00 +02:00
parent 31ec184a45
commit 18853f0588
3 changed files with 35 additions and 1 deletions

View file

@ -7,7 +7,6 @@ Menu/settings/saves
* Save locally first, make saving to cloud an option
* Allow to delete cloud saves
* Fix cloud save games with "Level 0 - 0 ships"
* Disable interaction and add loading dialog while loading from network
Map/story
---------
@ -19,6 +18,8 @@ Map/story
* Add factions and reputation
* Allow to cancel secondary missions
* Forbid to end up with more than 5 ships in the fleet because of escorts
* Fix problems when several dialogs are active at the same time
* Handle case where cargo is full to give a reward (give money ?)
Character sheet
---------------
@ -36,6 +37,10 @@ Battle
------
* Add a voluntary retreat option
* Fix AI not playing after loading a game where the next ship to play is AI
* Remove dead ships from ship list and play order
* Fix "thinking" rotating icon sometimes not rotating (after loading a game where AI plays for example)
* Add quick animation of playing ship indicator, on ship change
* Display effects description instead of attribute changes
* Display radius and power usage hints for area effects on action icon hover + add confirmation ?
* Any displayed info should be based on a ship copy stored in ArenaShip, and in sync with current log index (not the game state ship)

View file

@ -0,0 +1,22 @@
module TS.SpaceTac.UI {
/**
* Dialog with a waiting indicator
*/
export class UIWaitingDialog extends UIDialog {
constructor(view: BaseView, message: string, cancel?: Function) {
super(view);
this.addText(this.width * 0.5, this.height * 0.3, message, "#90FEE3", 32);
this.addImage(this.width * 0.5, this.height * 0.6, "common-waiting");
}
/**
* Display an error as the result of waiting.
*/
displayError(message: string) {
this.clearContent();
this.addText(this.width * 0.5, this.height * 0.5, message, "#FE7069", 32);
this.addCloseButton();
}
}
}

View file

@ -88,10 +88,17 @@ module TS.SpaceTac.UI {
if (this.save_selected >= 0 && this.saves.length > this.save_selected) {
let connection = this.view.getConnection();
let [saveid, saveinfo] = this.saves[this.save_selected];
let dialog = new UIWaitingDialog(this.view, "Loading game from server...");
connection.loadById(saveid).then(session => {
if (session) {
this.view.gameui.setSession(session);
dialog.close();
} else {
dialog.displayError("No suitable data found in save game (saved with older version ?)");
}
}).catch(() => {
dialog.displayError("Error while loading game from server");
});
}
}