1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 14:12:55 +08:00

Make leaderboard score use metric system

This commit is contained in:
Andrei Zavatski 2019-07-14 12:47:35 +03:00
parent d30ae24f58
commit 922c3c89ae
2 changed files with 30 additions and 8 deletions

View File

@ -43,8 +43,9 @@ namespace osu.Game.Tests.Visual.SongSelect
});
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
AddStep(@"Add score", () => topScoreContainer.TopScore.Value = scores[0]);
AddStep(@"Add another score", () => topScoreContainer.TopScore.Value = scores[1]);
AddStep(@"Add score(rank 999)", () => topScoreContainer.TopScore.Value = scores[0]);
AddStep(@"Add score(rank 110000)", () => topScoreContainer.TopScore.Value = scores[1]);
AddStep(@"Add score(rank 22333)", () => topScoreContainer.TopScore.Value = scores[2]);
AddStep(@"Add null score", () => topScoreContainer.TopScore.Value = null);
scores = new APILegacyUserTopScoreInfo[]
@ -91,6 +92,27 @@ namespace osu.Game.Tests.Visual.SongSelect
},
},
}
},
new APILegacyUserTopScoreInfo
{
Position = 22333,
Score = new APILegacyScoreInfo
{
Rank = ScoreRank.S,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
User = new User
{
Id = 1541390,
Username = @"Toukai",
Country = new Country
{
FullName = @"Canada",
FlagName = @"CA",
},
},
}
}
};
}

View File

@ -20,23 +20,23 @@ using osu.Game.Scoring;
using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;
using Humanizer;
namespace osu.Game.Online.Leaderboards
{
public class LeaderboardScore : OsuClickableContainer
{
public readonly int RankPosition;
public const float HEIGHT = 60;
private const float corner_radius = 5;
private const float edge_margin = 5;
private const float background_alpha = 0.25f;
private const float rank_width = 30;
private const float rank_width = 35;
protected Container RankContainer { get; private set; }
private readonly ScoreInfo score;
private readonly int rank;
private Box background;
private Container content;
@ -52,7 +52,7 @@ namespace osu.Game.Online.Leaderboards
public LeaderboardScore(ScoreInfo score, int rank)
{
this.score = score;
RankPosition = rank;
this.rank = rank;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
@ -79,8 +79,8 @@ namespace osu.Game.Online.Leaderboards
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 22, italics: true),
Text = RankPosition.ToString(),
Font = OsuFont.GetFont(size: 20, italics: true),
Text = rank <= 999 ? rank.ToString() : rank.ToMetric(decimals: rank < 100000 ? 1 : 0),
},
},
},