Skip to content

Show full rank in extended results screen #32428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions osu.Game.Tests/Visual/Ranking/TestSceneOverallRanking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ public void TestNotRanked()
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;
Expand Down
12 changes: 6 additions & 6 deletions osu.Game/Screens/Ranking/Statistics/User/GlobalRankChangeRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -18,7 +18,7 @@ public GlobalRankChangeRow()
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)
{
Expand All @@ -30,13 +30,13 @@ protected override int CalculateDifference(int? previous, int? current, out Loca

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;
}

Expand All @@ -46,9 +46,9 @@ protected override int CalculateDifference(int? previous, int? current, out Loca
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;

Expand Down
Loading