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

Improve colouring logic

This commit is contained in:
TheWildTree 2020-03-04 21:19:26 +01:00
parent 5838af39c1
commit 997be65be2
2 changed files with 30 additions and 9 deletions

View File

@ -37,10 +37,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider)
{
ProfileItemContainer container;
AddRangeInternal(new Drawable[]
{
new UpdateableBeatmapSetCover
@ -63,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CornerRadius = corner_radius,
Children = new Drawable[]
{
container = new ProfileItemContainer
new MostPlayedBeatmapContainer
{
Child = new Container
{
@ -108,9 +106,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
}
}
});
}
container.IdleColour = colourProvider.Background4;
container.HoverColour = colourProvider.Background3;
private class MostPlayedBeatmapContainer : ProfileItemContainer
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Background3;
}
}
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer

View File

@ -21,13 +21,29 @@ namespace osu.Game.Overlays.Profile.Sections
private Color4 idleColour;
public Color4 IdleColour
protected Color4 IdleColour
{
get => idleColour;
set => idleColour = background.Colour = value;
set
{
idleColour = value;
if (!IsHovered)
background.Colour = value;
}
}
public Color4 HoverColour { get; set; }
private Color4 hoverColour;
protected Color4 HoverColour
{
get => hoverColour;
set
{
hoverColour = value;
if (IsHovered)
background.Colour = value;
}
}
public ProfileItemContainer()
{