1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 20:33:35 +08:00

Replicate osu!web logic in display of matchmaking badge (#37303)

This commit is contained in:
Dan Balasescu
2026-04-15 15:49:10 +09:00
committed by GitHub
Unverified
parent 16882c64c5
commit 4fd4544442
2 changed files with 13 additions and 5 deletions
@@ -17,7 +17,7 @@ namespace osu.Game.Online.API.Requests.Responses
public int Rating { get; set; }
[JsonProperty("rank")]
public int Rank { get; set; }
public int? Rank { get; set; }
[JsonProperty("plays")]
public int Plays { get; set; }
@@ -114,12 +114,20 @@ namespace osu.Game.Overlays.Profile.Header.Components
return;
}
APIUserMatchmakingStatistics[] mostRelevantStats = stats.OrderByDescending(s => s.Pool.Active).ThenByDescending(s => s.Pool.Id).ToArray();
APIUserMatchmakingStatistics mostRelevantStat = mostRelevantStats.First();
int? highestRank = null;
rankText.Text = $"#{mostRelevantStat.Rank:N0}";
foreach (var stat in stats)
{
if (stat.Pool.Active && stat.Rank != null)
{
if (highestRank == null || stat.Rank < highestRank)
highestRank = stat.Rank;
}
}
TooltipContent = new MatchmakingStatsTooltipData(colourProvider, mostRelevantStats);
rankText.Text = highestRank == null ? "-" : $"#{highestRank:N0}";
TooltipContent = new MatchmakingStatsTooltipData(colourProvider, stats.OrderByDescending(s => s.PoolId).ToArray());
Show();
}