mirror of
https://github.com/ppy/osu.git
synced 2026-05-13 20:33:35 +08:00
Merge pull request #32428 from evilldev/show-full-rank
Show full rank in extended results screen
This commit is contained in:
@@ -105,6 +105,40 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
displayUpdate(statistics, statistics);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFromNothing()
|
||||
{
|
||||
createDisplay();
|
||||
displayUpdate(
|
||||
new UserStatistics(),
|
||||
new UserStatistics
|
||||
{
|
||||
GlobalRank = 12_345,
|
||||
Accuracy = 98.99,
|
||||
MaxCombo = 2_322,
|
||||
RankedScore = 23_123_543_456,
|
||||
TotalScore = 123_123_543_456,
|
||||
PP = 5_072
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestToNothing()
|
||||
{
|
||||
createDisplay();
|
||||
displayUpdate(
|
||||
new UserStatistics
|
||||
{
|
||||
GlobalRank = 12_345,
|
||||
Accuracy = 98.99,
|
||||
MaxCombo = 2_322,
|
||||
RankedScore = 23_123_543_456,
|
||||
TotalScore = 123_123_543_456,
|
||||
PP = 5_072
|
||||
},
|
||||
new UserStatistics());
|
||||
}
|
||||
|
||||
private void createDisplay() => AddStep("create display", () =>
|
||||
{
|
||||
statisticsUpdate.Value = null;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Screens.Ranking.Statistics.User
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
|
||||
protected override LocalisableString Label => UsersStrings.ShowRankGlobalSimple;
|
||||
|
||||
protected override LocalisableString FormatCurrentValue(int? current)
|
||||
=> current == null ? string.Empty : current.Value.FormatRank();
|
||||
=> current?.ToLocalisableString(@"N0") ?? string.Empty;
|
||||
|
||||
protected override int CalculateDifference(int? previous, int? current, out LocalisableString formattedDifference)
|
||||
{
|
||||
@@ -30,13 +30,13 @@ namespace osu.Game.Screens.Ranking.Statistics.User
|
||||
|
||||
if (previous == null && current != null)
|
||||
{
|
||||
formattedDifference = LocalisableString.Interpolate($"+{current.Value.FormatRank()}");
|
||||
formattedDifference = LocalisableString.Interpolate($"+{current.Value:N0}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (previous != null && current == null)
|
||||
{
|
||||
formattedDifference = LocalisableString.Interpolate($"-{previous.Value.FormatRank()}");
|
||||
formattedDifference = LocalisableString.Interpolate($"-{previous.Value:N0}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace osu.Game.Screens.Ranking.Statistics.User
|
||||
int difference = previous.Value - current.Value;
|
||||
|
||||
if (difference < 0)
|
||||
formattedDifference = difference.FormatRank();
|
||||
formattedDifference = difference.ToLocalisableString(@"N0");
|
||||
else if (difference > 0)
|
||||
formattedDifference = LocalisableString.Interpolate($"+{difference.FormatRank()}");
|
||||
formattedDifference = LocalisableString.Interpolate($"+{difference:N0}");
|
||||
else
|
||||
formattedDifference = string.Empty;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user