1
0
Fork 0

Added hover indicator in ship list

This commit is contained in:
Michaël Lemaire 2015-02-04 01:00:00 +01:00
parent 8287d9c3cd
commit 9a62388e57
3 changed files with 30 additions and 0 deletions

View file

@ -143,6 +143,7 @@ module SpaceTac.View {
this.ship_hovered = ship;
this.card_hovered.setShip(ship);
this.arena.setShipHovered(ship);
this.ship_list.setHovered(ship);
if (this.targetting) {
if (ship) {
this.targetting.setTargetShip(ship);

View file

@ -12,11 +12,15 @@ module SpaceTac.View {
// Playing ship
playing: ShipListItem;
// Hovered ship
hovered: ShipListItem;
// Create an empty action bar
constructor(battleview: BattleView) {
this.battleview = battleview;
this.ships = [];
this.playing = null;
this.hovered = null;
super(battleview.game, battleview.ui);
battleview.ui.add(this);
@ -81,5 +85,16 @@ module SpaceTac.View {
this.playing.setPlaying(true);
}
}
// Set the currently hovered ship
setHovered(ship: Game.Ship): void {
if (this.hovered) {
this.hovered.setHovered(false);
}
this.hovered = this.findItem(ship);
if (this.hovered) {
this.hovered.setHovered(true);
}
}
}
}

View file

@ -12,6 +12,9 @@ module SpaceTac.View {
// Shield display
shield: ValueBar;
// Hover indicator
layer_hover: Phaser.Image;
// Playing indicator
layer_playing: Phaser.Image;
@ -45,6 +48,12 @@ module SpaceTac.View {
this.layer_enemy = new Phaser.Image(this.game, 0, 0, owned ? "battle-shiplist-own" : "battle-shiplist-enemy", 0);
this.addChild(this.layer_enemy);
this.layer_hover = new Phaser.Image(this.game, 0, 0, "battle-arena-shipspritehover", 0);
this.layer_hover.visible = false;
this.layer_hover.scale.set(0.5, 0.5);
this.layer_hover.position.set(8, 5);
this.addChild(this.layer_hover);
this.hull = ValueBar.newStandard(list.battleview.game, 85, 28);
this.hull.scale.set(0.1, 0.1);
this.addChild(this.hull);
@ -72,5 +81,10 @@ module SpaceTac.View {
tween2.to({alpha: playing ? 0 : 1});
tween2.start();
}
// Set the hovered status
setHovered(hovered: boolean) {
this.layer_hover.visible = hovered;
}
}
}