Merge pull request #9899 from Joehuu/leaderboard-score-rank-tooltip

This commit is contained in:
Dean Herbert 2020-08-18 16:04:18 +09:00 committed by GitHub
commit c951940a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,20 +82,10 @@ namespace osu.Game.Online.Leaderboards
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new RankLabel(rank)
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = rank_width, Width = rank_width,
Children = new[]
{
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 20, italics: true),
Text = rank == null ? "-" : rank.Value.ToMetric(decimals: rank < 100000 ? 1 : 0),
},
},
}, },
content = new Container content = new Container
{ {
@ -356,6 +346,25 @@ namespace osu.Game.Online.Leaderboards
} }
} }
private class RankLabel : Container, IHasTooltip
{
public RankLabel(int? rank)
{
if (rank >= 1000)
TooltipText = $"#{rank:N0}";
Child = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 20, italics: true),
Text = rank == null ? "-" : rank.Value.ToMetric(decimals: rank < 100000 ? 1 : 0),
};
}
public string TooltipText { get; }
}
public class LeaderboardScoreStatistic public class LeaderboardScoreStatistic
{ {
public IconUsage Icon; public IconUsage Icon;