1
0
Fork 0

Fixed action tooltip sometimes sticking after ship changed

This commit is contained in:
Michaël Lemaire 2017-01-19 17:47:55 +01:00
parent 2a3a0717b9
commit 6ee0352cc1
3 changed files with 7 additions and 6 deletions

View file

@ -103,13 +103,12 @@ module SpaceTac.View {
// Set action icons from selected ship
setShip(ship: Game.Ship): void {
var action_bar = this;
this.clearAll();
if (ship.getPlayer() === this.battleview.player) {
var actions = ship.getAvailableActions();
actions.forEach((action: Game.BaseAction) => {
action_bar.addAction(ship, action);
this.addAction(ship, action);
});
this.ship = ship;

View file

@ -52,8 +52,10 @@ module SpaceTac.View {
this.addChild(this.layer_icon);
let show_info = () => {
this.bar.tooltip.setAction(this);
this.battleview.arena.range_hint.setSecondary(this.ship, this.action);
if (this.bar.ship)  {
this.bar.tooltip.setAction(this);
this.battleview.arena.range_hint.setSecondary(this.ship, this.action);
}
};
let hide_info = () => {
this.bar.tooltip.setAction(null);

View file

@ -79,14 +79,14 @@ module SpaceTac.View {
displayDamage(hull: number, shield: number) {
if (hull > 0) {
var hull_text = new Phaser.Text(this.game, -20, -20, Math.round(hull).toString(),
{ font: "bold 16pt Arial", align: "center", fill: "#ffbbbb" });
{ font: "bold 16pt Arial", align: "center", fill: "#eb4e4a" });
hull_text.anchor.set(0.5, 0.5);
this.addChild(hull_text);
this.animateDamageText(hull_text);
}
if (shield > 0) {
var shield_text = new Phaser.Text(this.game, 20, -20, Math.round(shield).toString(),
{ font: "bold 16pt Arial", align: "center", fill: "#bbbbff" });
{ font: "bold 16pt Arial", align: "center", fill: "#2ad8dc" });
shield_text.anchor.set(0.5, 0.5);
this.addChild(shield_text);
this.animateDamageText(shield_text);