2014-12-31 00:00:00 +00:00
|
|
|
module SpaceTac.View {
|
2015-01-07 00:00:00 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-12-31 00:00:00 +00:00
|
|
|
// Card to display detailed information about a ship
|
|
|
|
export class ShipCard extends Phaser.Sprite {
|
|
|
|
// Displayed ship
|
|
|
|
private ship: Game.Ship;
|
|
|
|
|
|
|
|
// Build an empty ship card
|
|
|
|
constructor(battleview: BattleView, x: number, y: number) {
|
2015-01-23 00:00:00 +00:00
|
|
|
super(battleview.game, x, y, "battle-ship-card");
|
2014-12-31 00:00:00 +00:00
|
|
|
|
|
|
|
this.ship = null;
|
|
|
|
this.visible = false;
|
|
|
|
|
|
|
|
battleview.ui.add(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the currently displayed ship (null to hide)
|
|
|
|
setShip(ship: Game.Ship) {
|
|
|
|
this.ship = ship;
|
2015-02-20 00:00:00 +00:00
|
|
|
Animation.setVisibility(this.game, this, ship !== null, 200);
|
2014-12-31 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-07 00:00:00 +00:00
|
|
|
}
|