1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Centralise trail visibility state management

This commit is contained in:
Bartłomiej Dach 2020-05-10 17:05:30 +02:00
parent 77e5e131c9
commit 5bab53b04c

View File

@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Catch.UI
dashing = value; dashing = value;
trails.DisplayTrail = value || HyperDashing; updateTrailVisibility();
} }
} }
@ -255,10 +255,7 @@ namespace osu.Game.Rulesets.Catch.UI
hyperDashDirection = 0; hyperDashDirection = 0;
if (wasHyperDashing) if (wasHyperDashing)
{ runHyperDashStateTransition(false);
updateCatcherColour(false);
trails.DisplayTrail &= Dashing;
}
} }
else else
{ {
@ -268,16 +265,18 @@ namespace osu.Game.Rulesets.Catch.UI
if (!wasHyperDashing) if (!wasHyperDashing)
{ {
updateCatcherColour(true);
trails.DisplayTrail = true;
trails.DisplayEndGlow(); trails.DisplayEndGlow();
runHyperDashStateTransition(true);
} }
} }
} }
private void updateCatcherColour(bool hyperDashing) private void runHyperDashStateTransition(bool hyperDashing)
{ {
trails.HyperDashTrailsColour = hyperDashColour;
trails.EndGlowSpritesColour = hyperDashEndGlowColour;
updateTrailVisibility();
if (hyperDashing) if (hyperDashing)
{ {
this.FadeColour(hyperDashColour, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint); this.FadeColour(hyperDashColour, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
@ -288,11 +287,10 @@ namespace osu.Game.Rulesets.Catch.UI
this.FadeColour(Color4.White, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint); this.FadeColour(Color4.White, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(1f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint); this.FadeTo(1f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
} }
trails.HyperDashTrailsColour = hyperDashColour;
trails.EndGlowSpritesColour = hyperDashEndGlowColour;
} }
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
public bool OnPressed(CatchAction action) public bool OnPressed(CatchAction action)
{ {
switch (action) switch (action)
@ -393,7 +391,7 @@ namespace osu.Game.Rulesets.Catch.UI
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashAfterImage)?.Value ?? skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashAfterImage)?.Value ??
hyperDashColour; hyperDashColour;
updateCatcherColour(HyperDashing); runHyperDashStateTransition(HyperDashing);
} }
protected override void Update() protected override void Update()