1
0
Fork 0

battle: Wait for the splash screen to end

This commit is contained in:
Michaël Lemaire 2017-09-13 00:53:03 +02:00
parent 98e75c67c8
commit f962f52b97
2 changed files with 15 additions and 8 deletions

View file

@ -86,6 +86,7 @@ module TS.SpaceTac.UI.Specs {
export function setupBattleview(): TestGame {
return setupSingleView(testgame => {
testgame.battleview = new BattleView();
testgame.battleview.splash = false;
let battle = Battle.newQuickRandom();
let player = battle.playing_ship ? battle.playing_ship.getPlayer() : new Player();

View file

@ -53,6 +53,9 @@ module TS.SpaceTac.UI {
// Tactical mode toggle
toggle_tactical_mode: Toggle
// Toggle for the splash screen display
splash = true
// Init the view, binding it to a specific battle
init(player: Player, battle: Battle) {
super.init();
@ -105,9 +108,6 @@ module TS.SpaceTac.UI {
this.targetting = new Targetting(this, this.action_bar);
this.targetting.moveToLayer(this.arena.layer_targetting);
// "Battle" animation
this.showSplash();
// BGM
this.gameui.audio.startMusic("mechanolith", 0.2);
@ -117,8 +117,14 @@ module TS.SpaceTac.UI {
this.inputs.bindCheat("x", "Lose current battle", () => this.battle.cheats.lose());
this.inputs.bindCheat("a", "Use AI to play", () => this.playAI());
// Start processing the log
this.log_processor.start();
// "Battle" animation, then start processing the log
if (this.splash) {
this.showSplash().then(() => {
this.log_processor.start();
});
} else {
this.log_processor.start();
}
// If we are on a remote session, start the exchange
if (!this.session.primary && this.gameui.session_token) {
@ -142,12 +148,12 @@ module TS.SpaceTac.UI {
}
/**
* Display the splash screen at the star of battle
* Display the splash screen at the start of battle
*/
showSplash(): void {
showSplash(): Promise<void> {
let splash = new BattleSplash(this, this.battle.fleets[0], this.battle.fleets[1]);
splash.moveToLayer(this.layer_overlay);
splash.start();
return splash.start();
}
// Method called when cursor starts hovering over a ship (or its icon)