From 64c96549101a7006ea946f80d23a2aebb019a16c Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 13:32:05 -0300 Subject: [PATCH 01/11] Make probationary groups a bit transparent --- .../Online/TestSceneUserProfileOverlay.cs | 4 +++- .../Profile/Header/Components/GroupBadge.cs | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index fc8c2c0b6e..67de015708 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -90,7 +90,9 @@ namespace osu.Game.Tests.Visual.Online { new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "mania" } }, - new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } } + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko", "fruits", "mania" } }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators (Probationary)", Playmodes = new[] { "osu", "taiko", "fruits", "mania" }, IsProbationary = true } }, ProfileOrder = new[] { diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index 4d6ee36254..afe7f278d4 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -42,12 +42,15 @@ namespace osu.Game.Overlays.Profile.Header.Components { FillFlowContainer innerContainer; - AddRangeInternal(new Drawable[] + // Normal background color is 0.75 opacity, probationary doesn't have this cause it will make them a bit transparent + var bgColor = group.IsProbationary ? colourProvider?.Background6 ?? Colour4.Black : (colourProvider?.Background6 ?? Colour4.Black).Opacity(0.75f); + + var groupDrawables = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider?.Background6 ?? Colour4.Black + Colour = bgColor }, innerContainer = new FillFlowContainer { @@ -68,7 +71,19 @@ namespace osu.Game.Overlays.Profile.Header.Components } } } - }); + }; + + AddRangeInternal(groupDrawables); + + // Probationary groups have an opacity of 60% + if (group.IsProbationary) + { + foreach (var drawable in groupDrawables) + { + drawable.Alpha = 0.6f; + } + } + if (group.Playmodes?.Length > 0) { From 933fc8cc836c6824c34752344e879e73df8984de Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 13:33:36 -0300 Subject: [PATCH 02/11] Fix comment --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index afe7f278d4..4634ab4381 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { FillFlowContainer innerContainer; - // Normal background color is 0.75 opacity, probationary doesn't have this cause it will make them a bit transparent + // Normal background color is 0.75 opacity, probationary doesn't have this cause they are a bit transparent already var bgColor = group.IsProbationary ? colourProvider?.Background6 ?? Colour4.Black : (colourProvider?.Background6 ?? Colour4.Black).Opacity(0.75f); var groupDrawables = new Drawable[] From de5eb63ceb17829ef6f8822ae07bc9dabc40808b Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 13:38:13 -0300 Subject: [PATCH 03/11] Fix codefactor --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index 4634ab4381..435cd43634 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -84,7 +84,6 @@ namespace osu.Game.Overlays.Profile.Header.Components } } - if (group.Playmodes?.Length > 0) { innerContainer.AddRange(group.Playmodes.Select(p => From e60a089f1a725c21d2842fc52f0e1ea3c9c73ad3 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 15:02:02 -0300 Subject: [PATCH 04/11] Set alpha on container instead of children --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index 435cd43634..e21b616a17 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -78,10 +78,7 @@ namespace osu.Game.Overlays.Profile.Header.Components // Probationary groups have an opacity of 60% if (group.IsProbationary) { - foreach (var drawable in groupDrawables) - { - drawable.Alpha = 0.6f; - } + Alpha = 0.6f; } if (group.Playmodes?.Length > 0) From aeebbe4003ce85c3b8e48f6db68026daae3e0785 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 15:12:40 -0300 Subject: [PATCH 05/11] Add group badges test from #22280 --- .../Visual/Online/TestSceneGroupBagdes.cs | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs b/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs new file mode 100644 index 0000000000..61158c0788 --- /dev/null +++ b/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs @@ -0,0 +1,92 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays.Profile.Header.Components; +using osuTK; + +namespace osu.Game.Tests.Visual.Online +{ + [TestFixture] + public partial class TestSceneGroupBagdes : OsuTestScene + { + public TestSceneGroupBagdes() + { + var groups = new[] + { + new APIUser(), + new APIUser + { + Groups = new[] + { + new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, + } + }, + new APIUser + { + Groups = new[] + { + new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } } + } + }, + new APIUser + { + Groups = new[] + { + new APIUserGroup { Colour = "#0066FF", ShortName = "PPY", Name = "peppy" }, + new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } } + } + }, + new APIUser + { + Groups = new[] + { + new APIUserGroup { Colour = "#0066FF", ShortName = "PPY", Name = "peppy" }, + new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" }, + new APIUserGroup { Colour = "#999999", ShortName = "ALM", Name = "osu! Alumni" }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } }, + new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators (Probationary)", Playmodes = new[] { "osu", "taiko" }, IsProbationary = true } + } + } + }; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Colour4.DarkGray + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(40), + Children = new[] + { + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(5), + ChildrenEnumerable = groups.Select(g => new GroupBadgeFlow { User = { Value = g } }) + }, + } + } + }; + } + } +} From 55976df3073110e3b1fe8672b257870e8d867744 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 16:43:03 -0300 Subject: [PATCH 06/11] Fix typo in test class name --- osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs b/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs index 61158c0788..cbf9c33b78 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs @@ -13,9 +13,9 @@ using osuTK; namespace osu.Game.Tests.Visual.Online { [TestFixture] - public partial class TestSceneGroupBagdes : OsuTestScene + public partial class TestSceneGroupBadges : OsuTestScene { - public TestSceneGroupBagdes() + public TestSceneGroupBadges() { var groups = new[] { From b62d4deb6f32b36eba85a7af306d3c2f4309dae1 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 17:17:19 -0300 Subject: [PATCH 07/11] Fix also typo on filename --- .../Online/{TestSceneGroupBagdes.cs => TestSceneGroupBadges.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game.Tests/Visual/Online/{TestSceneGroupBagdes.cs => TestSceneGroupBadges.cs} (100%) diff --git a/osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs b/osu.Game.Tests/Visual/Online/TestSceneGroupBadges.cs similarity index 100% rename from osu.Game.Tests/Visual/Online/TestSceneGroupBagdes.cs rename to osu.Game.Tests/Visual/Online/TestSceneGroupBadges.cs From 8d4889d5ce45655673059837e130a2fca99bda70 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 17:42:53 -0300 Subject: [PATCH 08/11] Cleanup --- .../Profile/Header/Components/GroupBadge.cs | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index e21b616a17..50eb37b74e 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -35,6 +35,11 @@ namespace osu.Game.Overlays.Profile.Header.Components CornerRadius = 8; TooltipText = group.Name; + + if (group.IsProbationary) + { + Alpha = 0.6f; + } } [BackgroundDependencyLoader] @@ -42,15 +47,15 @@ namespace osu.Game.Overlays.Profile.Header.Components { FillFlowContainer innerContainer; - // Normal background color is 0.75 opacity, probationary doesn't have this cause they are a bit transparent already - var bgColor = group.IsProbationary ? colourProvider?.Background6 ?? Colour4.Black : (colourProvider?.Background6 ?? Colour4.Black).Opacity(0.75f); + var bgColor = colourProvider?.Background6 ?? Colour4.Black; - var groupDrawables = new Drawable[] + AddRangeInternal(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = bgColor + // Normal background color is 0.75 opacity, probationary doesn't have this cause they are a bit transparent already + Colour = group.IsProbationary ? bgColor : bgColor.Opacity(0.75f), }, innerContainer = new FillFlowContainer { @@ -71,15 +76,7 @@ namespace osu.Game.Overlays.Profile.Header.Components } } } - }; - - AddRangeInternal(groupDrawables); - - // Probationary groups have an opacity of 60% - if (group.IsProbationary) - { - Alpha = 0.6f; - } + }); if (group.Playmodes?.Length > 0) { From 0eaebfd40a7a67e6ba9bd9f164b56d9140ce02bc Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Wed, 25 Jan 2023 10:22:42 -0300 Subject: [PATCH 09/11] Use Alpha instead of opacity on bg color --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index 50eb37b74e..4feb25e60b 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -47,15 +47,14 @@ namespace osu.Game.Overlays.Profile.Header.Components { FillFlowContainer innerContainer; - var bgColor = colourProvider?.Background6 ?? Colour4.Black; - AddRangeInternal(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, // Normal background color is 0.75 opacity, probationary doesn't have this cause they are a bit transparent already - Colour = group.IsProbationary ? bgColor : bgColor.Opacity(0.75f), + Colour = colourProvider?.Background6 ?? Colour4.Black, + Alpha = group.IsProbationary ? 1 : 0.75f, }, innerContainer = new FillFlowContainer { From 1de0bed83d0b8889900ef3b1ebcac52f178ef4a7 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Thu, 26 Jan 2023 11:09:16 -0300 Subject: [PATCH 10/11] fix comment --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index 4feb25e60b..ce1b0db76d 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -52,8 +52,8 @@ namespace osu.Game.Overlays.Profile.Header.Components new Box { RelativeSizeAxes = Axes.Both, - // Normal background color is 0.75 opacity, probationary doesn't have this cause they are a bit transparent already Colour = colourProvider?.Background6 ?? Colour4.Black, + // Normal badges background opacity is 75%, probationary is full opacity as the whole badge gets a bit transparent Alpha = group.IsProbationary ? 1 : 0.75f, }, innerContainer = new FillFlowContainer From f9809c948120ddccb36bd6e790e223b1503abe44 Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Fri, 3 Feb 2023 11:48:11 -0300 Subject: [PATCH 11/11] the comment --- osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index ce1b0db76d..4e17627e04 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -54,6 +54,8 @@ namespace osu.Game.Overlays.Profile.Header.Components RelativeSizeAxes = Axes.Both, Colour = colourProvider?.Background6 ?? Colour4.Black, // Normal badges background opacity is 75%, probationary is full opacity as the whole badge gets a bit transparent + // Goal is to match osu-web so this is the most accurate it can be, its a bit scuffed but it is what it is + // Source: https://github.com/ppy/osu-web/blob/master/resources/css/bem/user-group-badge.less#L50 Alpha = group.IsProbationary ? 1 : 0.75f, }, innerContainer = new FillFlowContainer