1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-05 04:52:53 +08:00

Apply NRT to StatisticsPanel

This commit is contained in:
Bartłomiej Dach 2024-05-14 13:01:26 +02:00
parent cb49147d1e
commit 10a8e84046
No known key found for this signature in database

View File

@ -1,8 +1,6 @@
// 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.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -28,19 +26,20 @@ namespace osu.Game.Screens.Ranking.Statistics
{ {
public const float SIDE_PADDING = 30; public const float SIDE_PADDING = 30;
public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>(); public readonly Bindable<ScoreInfo?> Score = new Bindable<ScoreInfo?>();
protected override bool StartHidden => true; protected override bool StartHidden => true;
[Resolved] [Resolved]
private BeatmapManager beatmapManager { get; set; } private BeatmapManager beatmapManager { get; set; } = null!;
private readonly Container content; private readonly Container content;
private readonly LoadingSpinner spinner; private readonly LoadingSpinner spinner;
private bool wasOpened; private bool wasOpened;
private Sample popInSample; private Sample? popInSample;
private Sample popOutSample; private Sample? popOutSample;
private CancellationTokenSource? loadCancellation;
public StatisticsPanel() public StatisticsPanel()
{ {
@ -71,9 +70,7 @@ namespace osu.Game.Screens.Ranking.Statistics
popOutSample = audio.Samples.Get(@"Results/statistics-panel-pop-out"); popOutSample = audio.Samples.Get(@"Results/statistics-panel-pop-out");
} }
private CancellationTokenSource loadCancellation; private void populateStatistics(ValueChangedEvent<ScoreInfo?> score)
private void populateStatistics(ValueChangedEvent<ScoreInfo> score)
{ {
loadCancellation?.Cancel(); loadCancellation?.Cancel();
loadCancellation = null; loadCancellation = null;
@ -187,7 +184,7 @@ namespace osu.Game.Screens.Ranking.Statistics
LoadComponentAsync(container, d => LoadComponentAsync(container, d =>
{ {
if (!Score.Value.Equals(newScore)) if (Score.Value?.Equals(newScore) != true)
return; return;
spinner.Hide(); spinner.Hide();