diff --git a/graphics/ui/battle.svg b/graphics/ui/battle.svg index a6479aa..c21b0aa 100644 --- a/graphics/ui/battle.svg +++ b/graphics/ui/battle.svg @@ -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%" /> - { 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]; diff --git a/src/view/battle/ActionIcon.ts b/src/view/battle/ActionIcon.ts index 93fc3ee..82f30c8 100644 --- a/src/view/battle/ActionIcon.ts +++ b/src/view/battle/ActionIcon.ts @@ -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; + } + } } } }