mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Add background colour customization to ProfileItemContainer
This commit is contained in:
parent
036f155afe
commit
5838af39c1
@ -16,12 +16,19 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private Color4 idleColour;
|
|
||||||
private Color4 hoverColour;
|
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
|
private Color4 idleColour;
|
||||||
|
|
||||||
|
public Color4 IdleColour
|
||||||
|
{
|
||||||
|
get => idleColour;
|
||||||
|
set => idleColour = background.Colour = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color4 HoverColour { get; set; }
|
||||||
|
|
||||||
public ProfileItemContainer()
|
public ProfileItemContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -44,20 +51,20 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
background.Colour = idleColour = colourProvider.Background3;
|
IdleColour = colourProvider.Background3;
|
||||||
hoverColour = colourProvider.Background2;
|
HoverColour = colourProvider.Background2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
|
background.FadeColour(HoverColour, hover_duration, Easing.OutQuint);
|
||||||
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);
|
background.FadeColour(IdleColour, hover_duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user