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)
{
performance.Value = (int)Math.Round(score.PP.Value, MidpointRounding.AwayFromZero);
setPerformanceValue(score.PP.Value);
}
else
{
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() =>
{
if (t.Result.HasValue)
performance.Value = (int)Math.Round(t.Result.Value, MidpointRounding.AwayFromZero);
}), cancellationTokenSource.Token);
.ContinueWith(t => Schedule(() => setPerformanceValue(t.Result)), cancellationTokenSource.Token);
}
}
private void setPerformanceValue(double? pp)
{
if (pp.HasValue)
performance.Value = (int)Math.Round(pp.Value, MidpointRounding.AwayFromZero);
}
public override void Appear()
{
base.Appear();