1
0
Fork 0

Fixed going back to menu after quick battle

This commit is contained in:
Michaël Lemaire 2017-02-05 23:03:35 +01:00
parent a6292ffef9
commit 3397009850
5 changed files with 25 additions and 6 deletions

3
TODO
View file

@ -1,3 +1,4 @@
* Add drones to apply temporary zone effects
* Allow to cancel last moves
* Effect should be random in a range (eg. "damage target 50-75")
* Add an overload/cooling system
@ -14,3 +15,5 @@
* Add a defeat screen (game over for now)
* Add a victory screen, with loot display
* Add retreat from battle
* Map : restore ability to jump to other systems
* Map : add stores

View file

@ -55,5 +55,12 @@ module TS.SpaceTac.Game {
getBattle(): Battle {
return this.player.getBattle();
}
/**
* Return true if the session has a universe to explore
*/
hasUniverse(): boolean {
return this.universe.stars.length > 0;
}
}
}

View file

@ -36,6 +36,16 @@ module TS.SpaceTac.View {
// Input manager
this.inputs = new InputManager(this);
// Browser console variable (for debugging purpose)
if (typeof window != "undefined") {
let session = this.gameui.session;
if (session) {
(<any>window).universe = session.universe;
(<any>window).player = session.player;
(<any>window).battle = session.player.getBattle();
}
}
}
}
}

View file

@ -6,7 +6,7 @@ module TS.SpaceTac.View {
var session = ui.session;
if (!session) {
// No universe, go back to main menu
// No session, go back to main menu
this.game.state.start("mainmenu", true, false);
} else if (session.getBattle()) {
// A battle is raging, go to it
@ -14,9 +14,12 @@ module TS.SpaceTac.View {
} else if (ui.getFocusedStar()) {
// Go to the focused star system
this.game.state.start("starsystem", true, false, ui.star, session.player);
} else {
} else if (session.hasUniverse()) {
// Go to the universe map
this.game.state.start("universe", true, false, session.universe, session.player);
} else {
// No battle, no universe, go back to menu
this.game.state.start("mainmenu", true, false);
}
}
}

View file

@ -53,10 +53,6 @@ module TS.SpaceTac.View {
this.ship_hovered = null;
this.log_processor = null;
this.background = null;
if (typeof window != "undefined") {
(<any>window).battle = this.battle;
}
}
// Create view graphics