Fixed drone tooltip being visible for destroyed drones
This commit is contained in:
parent
52706a1617
commit
040de7a71b
|
@ -17,7 +17,7 @@ module TS.SpaceTac.UI {
|
|||
|
||||
// Activation effect
|
||||
activation: Phaser.Graphics;
|
||||
|
||||
|
||||
// Destroyed state
|
||||
destroyed = false;
|
||||
|
||||
|
@ -46,7 +46,10 @@ module TS.SpaceTac.UI {
|
|||
this.sprite.anchor.set(0.5, 0.5);
|
||||
this.sprite.scale.set(0.1, 0.1);
|
||||
this.addChild(this.sprite);
|
||||
this.view.tooltip.bindDynamicText(this.sprite, () => this.drone.getDescription());
|
||||
|
||||
this.view.tooltip.bindDynamicText(this.sprite, () => {
|
||||
return this.destroyed ? "" : this.drone.getDescription();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +69,7 @@ module TS.SpaceTac.UI {
|
|||
tween.start();
|
||||
return 500;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the sprite as destroyed
|
||||
*/
|
||||
|
|
|
@ -90,8 +90,13 @@ module TS.SpaceTac.UI {
|
|||
*/
|
||||
bindDynamicText(obj: Phaser.Button, text_getter: () => string): void {
|
||||
this.bind(obj, container => {
|
||||
container.add(new Phaser.Text(container.game, 0, 0, text_getter(), { font: "bold 20pt Arial", fill: "#cccccc" }));
|
||||
return true;
|
||||
let content = text_getter();
|
||||
if (content) {
|
||||
container.add(new Phaser.Text(container.game, 0, 0, content, { font: "bold 20pt Arial", fill: "#cccccc" }));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue