From 05f77d2cabfa19201b98ee26f911261bf916642a Mon Sep 17 00:00:00 2001 From: EXtremeExploit Date: Sun, 22 Jan 2023 01:36:53 -0300 Subject: [PATCH] Add modes text to groups tooltip --- .../Visual/Online/TestSceneUserProfileOverlay.cs | 1 + .../Overlays/Profile/Header/Components/GroupBadge.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index f7e88e4437..fc8c2c0b6e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -89,6 +89,7 @@ namespace osu.Game.Tests.Visual.Online Groups = new[] { 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" } } }, ProfileOrder = new[] diff --git a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs index e62f1cebf0..654d2e9ef4 100644 --- a/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Header.Components { public partial class GroupBadge : Container, IHasTooltip { - public LocalisableString TooltipText { get; } + public LocalisableString TooltipText { get; set; } public int TextSize { get; set; } = 12; @@ -34,7 +34,9 @@ namespace osu.Game.Overlays.Profile.Header.Components Masking = true; CornerRadius = 8; + TooltipText = group.Name; + } [BackgroundDependencyLoader] @@ -79,6 +81,14 @@ namespace osu.Game.Overlays.Profile.Header.Components })).ToList() ); } + + if (group.Playmodes?.Length > 0) + { + var badgeModesList = group.Playmodes.Select(p => rulesets.GetRuleset(p)?.Name).ToList(); + + string modesDisplay = string.Join(", ", badgeModesList); + this.TooltipText += $" ({modesDisplay})"; + } } } }