mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 05:52:56 +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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -31,16 +28,16 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
private readonly IBeatmap playableBeatmap;
|
private readonly IBeatmap playableBeatmap;
|
||||||
|
|
||||||
private Drawable spinner;
|
private Drawable spinner = null!;
|
||||||
private Drawable content;
|
private Drawable content = null!;
|
||||||
private GridContainer chart;
|
private GridContainer chart = null!;
|
||||||
private OsuSpriteText achievedPerformance;
|
private OsuSpriteText achievedPerformance = null!;
|
||||||
private OsuSpriteText maximumPerformance;
|
private OsuSpriteText maximumPerformance = null!;
|
||||||
|
|
||||||
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
private BeatmapDifficultyCache difficultyCache { get; set; } = null!;
|
||||||
|
|
||||||
public PerformanceBreakdownChart(ScoreInfo score, IBeatmap playableBeatmap)
|
public PerformanceBreakdownChart(ScoreInfo score, IBeatmap playableBeatmap)
|
||||||
{
|
{
|
||||||
@ -147,7 +144,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
|
|
||||||
new PerformanceBreakdownCalculator(playableBeatmap, difficultyCache)
|
new PerformanceBreakdownCalculator(playableBeatmap, difficultyCache)
|
||||||
.CalculateAsync(score, cancellationTokenSource.Token)
|
.CalculateAsync(score, cancellationTokenSource.Token)
|
||||||
.ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely())));
|
.ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely()!)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPerformanceValue(PerformanceBreakdown breakdown)
|
private void setPerformanceValue(PerformanceBreakdown breakdown)
|
||||||
@ -189,8 +186,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
maximumPerformance.Text = Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero).ToLocalisableString();
|
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
|
// Don't display the attribute if its maximum is 0
|
||||||
// For example, flashlight bonus would be zero if flashlight mod isn't on
|
// 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)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
cancellationTokenSource?.Cancel();
|
cancellationTokenSource.Cancel();
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user