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

Add background colour customization to ProfileItemContainer

This commit is contained in:
TheWildTree 2020-02-28 21:09:49 +01:00
parent 036f155afe
commit 5838af39c1

View File

@ -16,12 +16,19 @@ namespace osu.Game.Overlays.Profile.Sections
protected override Container<Drawable> Content => content;
private Color4 idleColour;
private Color4 hoverColour;
private readonly Box background;
private readonly Container content;
private Color4 idleColour;
public Color4 IdleColour
{
get => idleColour;
set => idleColour = background.Colour = value;
}
public Color4 HoverColour { get; set; }
public ProfileItemContainer()
{
RelativeSizeAxes = Axes.Both;
@ -44,20 +51,20 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
background.Colour = idleColour = colourProvider.Background3;
hoverColour = colourProvider.Background2;
IdleColour = colourProvider.Background3;
HoverColour = colourProvider.Background2;
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
background.FadeColour(HoverColour, hover_duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
background.FadeColour(IdleColour, hover_duration, Easing.OutQuint);
}
}
}