1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix initial colour of leaderboard mod filter

This commit is contained in:
Joehu 2019-07-04 13:24:13 -07:00
parent bcea807697
commit ae7da2557e

View File

@ -37,6 +37,8 @@ namespace osu.Game.Graphics.UserInterface
text.Colour = AccentColour; text.Colour = AccentColour;
icon.Colour = AccentColour; icon.Colour = AccentColour;
} }
updateFade();
} }
} }
@ -48,28 +50,22 @@ namespace osu.Game.Graphics.UserInterface
private const float transition_length = 500; private const float transition_length = 500;
private void fadeIn() private void updateFade()
{ {
box.FadeIn(transition_length, Easing.OutQuint); box.FadeTo(IsHovered ? 1 : 0, transition_length, Easing.OutQuint);
text.FadeColour(Color4.White, transition_length, Easing.OutQuint); text.FadeColour(IsHovered ? Color4.White : AccentColour, transition_length, Easing.OutQuint);
}
private void fadeOut()
{
box.FadeOut(transition_length, Easing.OutQuint);
text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
fadeIn(); updateFade();
return base.OnHover(e); return base.OnHover(e);
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Current.Value) if (!Current.Value)
fadeOut(); updateFade();
base.OnHoverLost(e); base.OnHoverLost(e);
} }
@ -117,16 +113,7 @@ namespace osu.Game.Graphics.UserInterface
Current.ValueChanged += selected => Current.ValueChanged += selected =>
{ {
if (selected.NewValue) icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
{
fadeIn();
icon.Icon = FontAwesome.Regular.CheckCircle;
}
else
{
fadeOut();
icon.Icon = FontAwesome.Regular.Circle;
}
}; };
} }
} }