mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:43:21 +08: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>
|
/// <param name="token">An optional <see cref="CancellationToken"/> to cancel the operation.</param>
|
||||||
public async Task<double> CalculatePerformanceAsync([NotNull] ScoreInfo score, CancellationToken token = default)
|
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))
|
if (tryGetExisting(score, out var perf, out var lookupKey))
|
||||||
return perf;
|
return perf;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
{
|
{
|
||||||
private readonly int count;
|
private readonly int count;
|
||||||
|
|
||||||
protected RollingCounter<int> Counter;
|
protected RollingCounter<int> Counter { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="CounterStatistic"/>.
|
/// Creates a new <see cref="CounterStatistic"/>.
|
||||||
|
@ -25,8 +25,15 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ScorePerformanceManager performanceManager)
|
private void load(ScorePerformanceManager performanceManager)
|
||||||
{
|
{
|
||||||
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
|
if (score.PP.HasValue)
|
||||||
.ContinueWith(t => Schedule(() => performance.Value = (int)t.Result), cancellationTokenSource.Token);
|
{
|
||||||
|
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()
|
public override void Appear()
|
||||||
@ -37,7 +44,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
cancellationTokenSource.Cancel();
|
cancellationTokenSource?.Cancel();
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user