1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 09:02:57 +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] [BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider) private void load(OverlayColourProvider colourProvider)
{ {
ProfileItemContainer container;
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
new UpdateableBeatmapSetCover new UpdateableBeatmapSetCover
@ -63,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CornerRadius = corner_radius, CornerRadius = corner_radius,
Children = new Drawable[] Children = new Drawable[]
{ {
container = new ProfileItemContainer new MostPlayedBeatmapContainer
{ {
Child = new Container Child = new Container
{ {
@ -108,9 +106,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
} }
} }
}); });
}
container.IdleColour = colourProvider.Background4; private class MostPlayedBeatmapContainer : ProfileItemContainer
container.HoverColour = colourProvider.Background3; {
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Background3;
}
} }
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer

View File

@ -21,13 +21,29 @@ namespace osu.Game.Overlays.Profile.Sections
private Color4 idleColour; private Color4 idleColour;
public Color4 IdleColour protected Color4 IdleColour
{ {
get => 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() public ProfileItemContainer()
{ {