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

Extract helper function for pp value handling

This commit is contained in:
Bartłomiej Dach 2020-10-12 22:14:39 +02:00
parent d4ba9d2682
commit 68b505ab86

View File

@ -28,19 +28,21 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
{ {
if (score.PP.HasValue) if (score.PP.HasValue)
{ {
performance.Value = (int)Math.Round(score.PP.Value, MidpointRounding.AwayFromZero); setPerformanceValue(score.PP.Value);
} }
else else
{ {
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token) performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => .ContinueWith(t => Schedule(() => setPerformanceValue(t.Result)), cancellationTokenSource.Token);
{
if (t.Result.HasValue)
performance.Value = (int)Math.Round(t.Result.Value, MidpointRounding.AwayFromZero);
}), cancellationTokenSource.Token);
} }
} }
private void setPerformanceValue(double? pp)
{
if (pp.HasValue)
performance.Value = (int)Math.Round(pp.Value, MidpointRounding.AwayFromZero);
}
public override void Appear() public override void Appear()
{ {
base.Appear(); base.Appear();