1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Fix toolbar PP change showing +0 instead of 0

This commit is contained in:
Dean Herbert 2024-08-19 20:50:11 +09:00
parent 24a0a3c47f
commit 610ebc5481
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -142,7 +142,7 @@ namespace osu.Game.Tests.Visual.Menus
new UserStatistics
{
GlobalRank = 111_111,
PP = 1357
PP = 1357.1m
});
});
AddStep("Was null", () =>

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar
public Bindable<UserStatisticsUpdate?> LatestUpdate { get; } = new Bindable<UserStatisticsUpdate?>();
private Statistic<int> globalRank = null!;
private Statistic<decimal> pp = null!;
private Statistic<int> pp = null!;
[BackgroundDependencyLoader]
private void load(UserStatisticsWatcher? userStatisticsWatcher)
@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar
Children = new Drawable[]
{
globalRank = new Statistic<int>(UsersStrings.ShowRankGlobalSimple, @"#", Comparer<int>.Create((before, after) => before - after)),
pp = new Statistic<decimal>(RankingsStrings.StatPerformance, string.Empty, Comparer<decimal>.Create((before, after) => Math.Sign(after - before))),
pp = new Statistic<int>(RankingsStrings.StatPerformance, string.Empty, Comparer<int>.Create((before, after) => Math.Sign(after - before))),
}
};
@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Toolbar
}
if (update.After.PP != null)
pp.Display(update.Before.PP ?? update.After.PP.Value, Math.Abs((update.After.PP - update.Before.PP) ?? 0M), update.After.PP.Value);
pp.Display((int)(update.Before.PP ?? update.After.PP.Value), (int)Math.Abs((update.After.PP - update.Before.PP) ?? 0M), (int)update.After.PP.Value);
this.Delay(5000).FadeOut(500, Easing.OutQuint);
});