mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 12:07:23 +08:00
Fix incorrect CancellationToken usage
Apparently I wrote the BDL system and don't know how this works. I believe you need `CancellationToken?` or CanBeNull=true, however that doesn't actually play well when actually using the token in code...
This commit is contained in:
parent
593da79bbc
commit
5624dd9af6
@ -49,20 +49,22 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private Ruleset gameplayRuleset;
|
private Ruleset gameplayRuleset;
|
||||||
|
|
||||||
|
private readonly CancellationTokenSource loadCancellationSource = new CancellationTokenSource();
|
||||||
|
|
||||||
public PerformancePointsCounter()
|
public PerformancePointsCounter()
|
||||||
{
|
{
|
||||||
Current.Value = DisplayedCount = 0;
|
Current.Value = DisplayedCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, BeatmapDifficultyCache difficultyCache, CancellationToken cancellationToken)
|
private void load(OsuColour colours, BeatmapDifficultyCache difficultyCache)
|
||||||
{
|
{
|
||||||
Colour = colours.BlueLighter;
|
Colour = colours.BlueLighter;
|
||||||
|
|
||||||
if (gameplayState != null)
|
if (gameplayState != null)
|
||||||
{
|
{
|
||||||
gameplayRuleset = gameplayState.Ruleset;
|
gameplayRuleset = gameplayState.Ruleset;
|
||||||
difficultyCache.GetTimedDifficultyAttributesAsync(new GameplayWorkingBeatmap(gameplayState.Beatmap), gameplayRuleset, gameplayState.Mods.ToArray(), cancellationToken)
|
difficultyCache.GetTimedDifficultyAttributesAsync(new GameplayWorkingBeatmap(gameplayState.Beatmap), gameplayRuleset, gameplayState.Mods.ToArray(), loadCancellationSource.Token)
|
||||||
.ContinueWith(r => Schedule(() => timedAttributes = r.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
|
.ContinueWith(r => Schedule(() => timedAttributes = r.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +103,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
if (scoreProcessor != null)
|
if (scoreProcessor != null)
|
||||||
scoreProcessor.NewJudgement -= onNewJudgement;
|
scoreProcessor.NewJudgement -= onNewJudgement;
|
||||||
|
|
||||||
|
loadCancellationSource?.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TextComponent : CompositeDrawable, IHasText
|
private class TextComponent : CompositeDrawable, IHasText
|
||||||
|
Loading…
Reference in New Issue
Block a user