1
0
Fork 0
spacetac/src/scripts/view/battle/ShipListItem.ts

25 lines
794 B
TypeScript
Raw Normal View History

module SpaceTac.View {
2015-01-07 00:00:00 +00:00
"use strict";
// 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;
// Create a ship button for the battle ship list
constructor(list: ShipList, x: number, y: number, ship: Game.Ship, owned: boolean) {
2014-12-31 00:00:00 +00:00
this.ship = ship;
2015-01-23 00:00:00 +00:00
super(list.battleview.game, x, y, owned ? "battle-shiplist-own" : "battle-shiplist-enemy");
2014-12-31 00:00:00 +00:00
this.input.useHandCursor = true;
2014-12-31 00:00:00 +00:00
this.onInputOver.add(() => {
list.battleview.cursorOnShip(ship);
2014-12-31 00:00:00 +00:00
});
this.onInputOut.add(() => {
list.battleview.cursorOffShip(ship);
2014-12-31 00:00:00 +00:00
});
}
}
2015-01-07 00:00:00 +00:00
}