1
0
Fork 0

Replaced fading action overlay by blinking lights

This commit is contained in:
Michaël Lemaire 2017-01-13 01:28:23 +01:00
parent 41a257df7a
commit 1f1f693a8c
4 changed files with 21 additions and 14 deletions

View file

@ -383,11 +383,11 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568542"
inkscape:cx="243.62481"
inkscape:cy="1128.5583"
inkscape:zoom="2"
inkscape:cx="159.70712"
inkscape:cy="1005.3619"
inkscape:document-units="px"
inkscape:current-layer="layer25"
inkscape:current-layer="layer9"
showgrid="false"
units="px"
showguides="true"
@ -1142,10 +1142,6 @@
width="100%"
height="100%" />
</g>
<g
inkscape:groupmode="layer"
id="layer25"
inkscape:label="Action icon fading" />
</g>
<g
inkscape:groupmode="layer"

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 B

View file

@ -56,7 +56,7 @@ module SpaceTac.View.Specs {
var checkFading = (fading: number[], available: number[]) => {
fading.forEach((index: number) => {
var icon = bar.actions[index];
expect(icon.fading).toBe(true);
expect(icon.fading || !icon.active).toBe(true);
});
available.forEach((index: number) => {
var icon = bar.actions[index];

View file

@ -145,16 +145,27 @@ module SpaceTac.View {
// Update the active status, from the action canBeUsed result
updateActiveStatus(): void {
var old_active = this.active;
this.active = this.action.canBeUsed(this.battleview.battle, this.ship);
Animation.setVisibility(this.game, this.layer_active, this.active, 500);
this.game.tweens.create(this.layer_icon).to({ alpha: this.active ? 1 : 0.3 }, 500).start();
this.input.useHandCursor = this.active;
if (this.active != old_active) {
Animation.setVisibility(this.game, this.layer_active, this.active, 500);
this.game.tweens.create(this.layer_icon).to({ alpha: this.active ? 1 : 0.3 }, 500).start();
this.input.useHandCursor = this.active;
}
}
// Update the fading status, given an hypothetical remaining AP
updateFadingStatus(remaining_ap: number): void {
this.fading = !this.action.canBeUsed(this.battleview.battle, this.ship, remaining_ap);
Animation.setVisibility(this.game, this.layer_fading, this.fading && this.active, 200);
var old_fading = this.fading;
this.fading = this.active && !this.action.canBeUsed(this.battleview.battle, this.ship, remaining_ap);
if (this.fading != old_fading) {
if (this.fading) {
this.game.tweens.create(this.layer_active).to({ alpha: 0.4 }, 100).delay(180).to({ alpha: 1 }, 90).to({ alpha: 0.4 }, 80).delay(130).to({ alpha: 1 }, 100).to({ alpha: 0.4 }, 90).delay(160).to({ alpha: 0.8 }, 70).loop(true).start();
} else {
this.game.tweens.removeFrom(this.layer_active);
this.layer_active.alpha = this.active ? 1 : 0;
}
}
}
}
}