Apply review suggestions.

This commit is contained in:
Lucas A 2020-09-28 19:05:22 +02:00
parent 6efc4c4250
commit 35f7de2084
3 changed files with 11 additions and 7 deletions

View File

@ -27,9 +27,6 @@ namespace osu.Game.Scoring
/// <param name="token">An optional <see cref="CancellationToken"/> to cancel the operation.</param>
public async Task<double> CalculatePerformanceAsync([NotNull] ScoreInfo score, CancellationToken token = default)
{
if (score.PP.HasValue)
return score.PP.Value;
if (tryGetExisting(score, out var perf, out var lookupKey))
return perf;

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
private readonly int count;
protected RollingCounter<int> Counter;
protected RollingCounter<int> Counter { get; private set; }
/// <summary>
/// Creates a new <see cref="CounterStatistic"/>.

View File

@ -25,8 +25,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
[BackgroundDependencyLoader]
private void load(ScorePerformanceManager performanceManager)
{
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => performance.Value = (int)t.Result), cancellationTokenSource.Token);
if (score.PP.HasValue)
{
performance.Value = (int)score.PP.Value;
}
else
{
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => performance.Value = (int)t.Result), cancellationTokenSource.Token);
}
}
public override void Appear()
@ -37,7 +44,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
protected override void Dispose(bool isDisposing)
{
cancellationTokenSource.Cancel();
cancellationTokenSource?.Cancel();
base.Dispose(isDisposing);
}
}