mirror of
https://github.com/ppy/osu.git
synced 2026-05-17 17:33:02 +08:00
Show vote count in tag tooltip
This commit is contained in:
@@ -117,7 +117,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"owners")]
|
||||
public BeatmapOwner[] BeatmapOwners { get; set; } = Array.Empty<BeatmapOwner>();
|
||||
|
||||
public APITag[] GetTopUserTags()
|
||||
public (APITag Tag, int VoteCount)[] GetTopUserTags()
|
||||
{
|
||||
if (TopTags == null || TopTags.Length == 0 || BeatmapSet?.RelatedTags == null)
|
||||
return [];
|
||||
@@ -130,7 +130,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
// see https://github.com/ppy/osu-web/blob/bb3bd2e7c6f84f26066df5ea20a81c77ec9bb60a/resources/js/beatmapsets-show/controller.ts#L103-L106 for sort criteria
|
||||
.OrderByDescending(t => t.topTag.VoteCount)
|
||||
.ThenBy(t => t.relatedTag!.Name)
|
||||
.Select(t => t.relatedTag!)
|
||||
.Select(t => (t.relatedTag!, t.topTag.VoteCount))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
private void updateUserTags()
|
||||
{
|
||||
userTags.Metadata = Beatmap.Value.GetTopUserTags().Select(t => t.Name).ToArray();
|
||||
userTags.Metadata = Beatmap.Value.GetTopUserTags().Select(t => t.Tag.Name).ToArray();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
||||
+2
-2
@@ -458,7 +458,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
new OsuSpriteText
|
||||
{
|
||||
Padding = new MarginPadding { Vertical = 3, Horizontal = 8 },
|
||||
Text = beatmap.GetTopUserTags().FirstOrDefault()?.Name ?? string.Empty,
|
||||
Text = beatmap.GetTopUserTags().FirstOrDefault().Tag?.Name ?? string.Empty,
|
||||
AlwaysPresent = true,
|
||||
Colour = colourProvider.Content2,
|
||||
Font = OsuFont.Style.Caption2,
|
||||
@@ -468,7 +468,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match.BeatmapSelect
|
||||
};
|
||||
}
|
||||
|
||||
public LocalisableString TooltipText => string.Join('\n', beatmap.GetTopUserTags().Select(t => t.Name));
|
||||
public LocalisableString TooltipText => string.Join('\n', beatmap.GetTopUserTags().Select(t => $"{t.Tag.Name} ({t.VoteCount})"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user