mirror of
https://github.com/ppy/osu
synced 2025-02-13 08:37:48 +00:00
Apply review suggestions.
This commit is contained in:
parent
6efc4c4250
commit
35f7de2084
@ -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;
|
||||
|
||||
|
@ -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"/>.
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user