mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 23:43:03 +08:00
Apply NRT to PerformanceBreakdownChart
This commit is contained in:
parent
77a7f475ee
commit
2f2257f6ce
@ -1,13 +1,10 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -31,16 +28,16 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
private readonly ScoreInfo score;
|
||||
private readonly IBeatmap playableBeatmap;
|
||||
|
||||
private Drawable spinner;
|
||||
private Drawable content;
|
||||
private GridContainer chart;
|
||||
private OsuSpriteText achievedPerformance;
|
||||
private OsuSpriteText maximumPerformance;
|
||||
private Drawable spinner = null!;
|
||||
private Drawable content = null!;
|
||||
private GridContainer chart = null!;
|
||||
private OsuSpriteText achievedPerformance = null!;
|
||||
private OsuSpriteText maximumPerformance = null!;
|
||||
|
||||
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
[Resolved]
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; } = null!;
|
||||
|
||||
public PerformanceBreakdownChart(ScoreInfo score, IBeatmap playableBeatmap)
|
||||
{
|
||||
@ -147,7 +144,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
|
||||
new PerformanceBreakdownCalculator(playableBeatmap, difficultyCache)
|
||||
.CalculateAsync(score, cancellationTokenSource.Token)
|
||||
.ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely())));
|
||||
.ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely()!)));
|
||||
}
|
||||
|
||||
private void setPerformanceValue(PerformanceBreakdown breakdown)
|
||||
@ -189,8 +186,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
maximumPerformance.Text = Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString();
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
||||
private Drawable[]? createAttributeRow(PerformanceDisplayAttribute attribute, PerformanceDisplayAttribute perfectAttribute)
|
||||
{
|
||||
// Don't display the attribute if its maximum is 0
|
||||
// For example, flashlight bonus would be zero if flashlight mod isn't on
|
||||
@ -239,7 +235,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
cancellationTokenSource?.Cancel();
|
||||
cancellationTokenSource.Cancel();
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user