From 036f155afe755d961c99fa891cc3b9095b733cf6 Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Fri, 28 Feb 2020 21:09:31 +0100 Subject: [PATCH 1/5] Adjust colours in DrawableMostPlayedBeatmap --- .../Historical/DrawableMostPlayedBeatmap.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs index e75ad2f161..dc8492562a 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs @@ -37,8 +37,10 @@ namespace osu.Game.Overlays.Profile.Sections.Historical } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OverlayColourProvider colourProvider) { + ProfileItemContainer container; + AddRangeInternal(new Drawable[] { new UpdateableBeatmapSetCover @@ -61,7 +63,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical CornerRadius = corner_radius, Children = new Drawable[] { - new ProfileItemContainer + container = new ProfileItemContainer { Child = new Container { @@ -78,11 +80,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical Children = new Drawable[] { new MostPlayedBeatmapMetadataContainer(beatmap), - new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular)) + new LinkFlowContainer(t => + { + t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular); + t.Colour = colourProvider.Foreground1; + }) { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Colour = colours.GreySeafoamLighter }.With(d => { d.AddText("mapped by "); @@ -103,6 +108,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical } } }); + + container.IdleColour = colourProvider.Background4; + container.HoverColour = colourProvider.Background3; } private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer From 5838af39c1a20cc8bc1dc5fc6aab93c4dc82403f Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Fri, 28 Feb 2020 21:09:49 +0100 Subject: [PATCH 2/5] Add background colour customization to ProfileItemContainer --- .../Profile/Sections/ProfileItemContainer.cs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs index f65c909155..a48f21f52b 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs @@ -16,12 +16,19 @@ namespace osu.Game.Overlays.Profile.Sections protected override Container 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); } } } From 997be65be2329d3a3376f1ca16914622e767da0f Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Wed, 4 Mar 2020 21:19:26 +0100 Subject: [PATCH 3/5] Improve colouring logic --- .../Historical/DrawableMostPlayedBeatmap.cs | 17 +++++++++----- .../Profile/Sections/ProfileItemContainer.cs | 22 ++++++++++++++++--- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs index dc8492562a..5b7c5efbe2 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedBeatmap.cs @@ -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 diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs index a48f21f52b..1ab9ed3f82 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs @@ -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() { From bd1dbea6f4b35937777ef3f5b017d2bf787e35e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 Mar 2020 23:10:14 +0100 Subject: [PATCH 4/5] Centralise background colour updates --- .../Profile/Sections/ProfileItemContainer.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs index 1ab9ed3f82..c057ebe12b 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs @@ -27,8 +27,7 @@ namespace osu.Game.Overlays.Profile.Sections set { idleColour = value; - if (!IsHovered) - background.Colour = value; + fadeBackgroundColour(); } } @@ -40,8 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections set { hoverColour = value; - if (IsHovered) - background.Colour = value; + fadeBackgroundColour(); } } @@ -73,14 +71,19 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnHover(HoverEvent e) { - background.FadeColour(HoverColour, hover_duration, Easing.OutQuint); + fadeBackgroundColour(hover_duration); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent 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); } } } From 5b0846cb69a2f5aca2da311d179169fc1c0f5deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 5 Mar 2020 23:15:53 +0100 Subject: [PATCH 5/5] Handle hover explicitly --- osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs index c057ebe12b..afa6bd9f79 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs @@ -72,7 +72,7 @@ namespace osu.Game.Overlays.Profile.Sections protected override bool OnHover(HoverEvent e) { fadeBackgroundColour(hover_duration); - return base.OnHover(e); + return true; } protected override void OnHoverLost(HoverLostEvent e)