mirror of
https://github.com/ppy/osu.git
synced 2025-01-09 04:32:57 +08:00
Centralise background colour updates
This commit is contained in:
parent
f5e6f92ac6
commit
bd1dbea6f4
@ -27,8 +27,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
idleColour = value;
|
idleColour = value;
|
||||||
if (!IsHovered)
|
fadeBackgroundColour();
|
||||||
background.Colour = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
hoverColour = value;
|
hoverColour = value;
|
||||||
if (IsHovered)
|
fadeBackgroundColour();
|
||||||
background.Colour = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,14 +71,19 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
background.FadeColour(HoverColour, hover_duration, Easing.OutQuint);
|
fadeBackgroundColour(hover_duration);
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
background.FadeColour(IdleColour, hover_duration, Easing.OutQuint);
|
fadeBackgroundColour(hover_duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeBackgroundColour(double fadeDuration = 0)
|
||||||
|
{
|
||||||
|
background.FadeColour(IsHovered ? HoverColour : IdleColour, fadeDuration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user