2014-12-31 00:00:00 +00:00
|
|
|
module SpaceTac.View {
|
2014-12-30 00:00:00 +00:00
|
|
|
// One item in a ship list (used in BattleView)
|
|
|
|
export class ShipListItem extends Phaser.Button {
|
2014-12-31 00:00:00 +00:00
|
|
|
// Reference to the ship game object
|
|
|
|
private ship: Game.Ship;
|
|
|
|
|
2014-12-30 00:00:00 +00:00
|
|
|
// Create a ship button for the battle ship list
|
2014-12-31 00:00:00 +00:00
|
|
|
constructor(battleview: BattleView, x: number, y: number, ship:Game.Ship, owned: boolean) {
|
|
|
|
this.ship = ship;
|
|
|
|
|
|
|
|
super(battleview.game, x, y, owned ? 'ui-shiplist-own' : 'ui-shiplist-enemy');
|
|
|
|
battleview.ui.add(this);
|
|
|
|
|
2014-12-31 00:00:00 +00:00
|
|
|
this.input.useHandCursor = true;
|
2014-12-31 00:00:00 +00:00
|
|
|
this.onInputOver.add(() => {
|
|
|
|
battleview.cursorOnShip(ship);
|
|
|
|
});
|
|
|
|
this.onInputOut.add(() => {
|
|
|
|
battleview.cursorOffShip(ship);
|
|
|
|
});
|
2014-12-30 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|