mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Make leaderboard score use metric system
This commit is contained in:
@ -43,8 +43,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
||||||
AddStep(@"Add score", () => topScoreContainer.TopScore.Value = scores[0]);
|
AddStep(@"Add score(rank 999)", () => topScoreContainer.TopScore.Value = scores[0]);
|
||||||
AddStep(@"Add another score", () => topScoreContainer.TopScore.Value = scores[1]);
|
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);
|
AddStep(@"Add null score", () => topScoreContainer.TopScore.Value = null);
|
||||||
|
|
||||||
scores = new APILegacyUserTopScoreInfo[]
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,23 +20,23 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using Humanizer;
|
||||||
|
|
||||||
namespace osu.Game.Online.Leaderboards
|
namespace osu.Game.Online.Leaderboards
|
||||||
{
|
{
|
||||||
public class LeaderboardScore : OsuClickableContainer
|
public class LeaderboardScore : OsuClickableContainer
|
||||||
{
|
{
|
||||||
public readonly int RankPosition;
|
|
||||||
|
|
||||||
public const float HEIGHT = 60;
|
public const float HEIGHT = 60;
|
||||||
|
|
||||||
private const float corner_radius = 5;
|
private const float corner_radius = 5;
|
||||||
private const float edge_margin = 5;
|
private const float edge_margin = 5;
|
||||||
private const float background_alpha = 0.25f;
|
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; }
|
protected Container RankContainer { get; private set; }
|
||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
|
private readonly int rank;
|
||||||
|
|
||||||
private Box background;
|
private Box background;
|
||||||
private Container content;
|
private Container content;
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
public LeaderboardScore(ScoreInfo score, int rank)
|
public LeaderboardScore(ScoreInfo score, int rank)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
RankPosition = rank;
|
this.rank = rank;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
@ -79,8 +79,8 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = OsuFont.GetFont(size: 22, italics: true),
|
Font = OsuFont.GetFont(size: 20, italics: true),
|
||||||
Text = RankPosition.ToString(),
|
Text = rank <= 999 ? rank.ToString() : rank.ToMetric(decimals: rank < 100000 ? 1 : 0),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user