Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modes text to groups tooltip #22340

Merged
merged 6 commits into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add modes text to groups tooltip
  • Loading branch information
EXtremeExploit committed Jan 22, 2023
commit 05f77d2cabfa19201b98ee26f911261bf916642a
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public void TestLoading()
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[]
Expand Down
12 changes: 11 additions & 1 deletion osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -34,7 +34,9 @@ public GroupBadge(APIUserGroup group)
Masking = true;
CornerRadius = 8;


TooltipText = group.Name;

}

[BackgroundDependencyLoader]
Expand Down Expand Up @@ -79,6 +81,14 @@ private void load(OverlayColourProvider? colourProvider, RulesetStore rulesets)
})).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})";
}
}
}
}