1
0
Fork 0

Fixed arena not destroying properly when changing UI state

This commit is contained in:
Michaël Lemaire 2015-03-06 01:00:00 +01:00
parent 17afcb2b0d
commit 28d431e40e
2 changed files with 7 additions and 10 deletions

View file

@ -64,17 +64,16 @@ module SpaceTac.View {
destroy() {
this.game.input.deleteMoveCallback(this.input_callback);
super.destroy();
}
// Initialize state (create sprites)
init(): void {
var arena = this;
// Add ship sprites
this.battleview.battle.play_order.forEach(function (ship: Game.Ship) {
var sprite = new ArenaShip(arena.battleview, ship);
arena.addChild(sprite);
arena.ship_sprites.push(sprite);
this.battleview.battle.play_order.forEach((ship: Game.Ship) => {
var sprite = new ArenaShip(this.battleview, ship);
this.addChild(sprite);
this.ship_sprites.push(sprite);
});
}

View file

@ -106,11 +106,9 @@ module SpaceTac.View {
// Start processing the battle log
this.log_processor = new LogProcessor(this);
// Handle space bar to end turn
this.space_key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
// Key mapping
this.space_key = this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
this.space_key.onUp.add(this.onSpaceKeyPressed, this);
// Shortcuts
var key_s = this.input.keyboard.addKey(Phaser.Keyboard.S);
key_s.onUp.add(() => {
(<GameRouter>this.game).saveGame();