mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Schedule difficulty calculation to avoid performing with incomplete state updates
This commit is contained in:
parent
39221a52da
commit
8f37e69dc4
@ -150,7 +150,14 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
|
|
||||||
private CancellationTokenSource starDifficultyCancellationSource;
|
private CancellationTokenSource starDifficultyCancellationSource;
|
||||||
|
|
||||||
private void updateStarDifficulty()
|
/// <summary>
|
||||||
|
/// Updates the displayed star difficulty statistics with the values provided by the currently-selected beatmap, ruleset, and selected mods.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is scheduled to avoid scenarios wherein a ruleset changes first before selected mods do,
|
||||||
|
/// potentially resulting in failure during difficulty calculation due to incomplete bindable state updates.
|
||||||
|
/// </remarks>
|
||||||
|
private void updateStarDifficulty() => Scheduler.AddOnce(() =>
|
||||||
{
|
{
|
||||||
starDifficultyCancellationSource?.Cancel();
|
starDifficultyCancellationSource?.Cancel();
|
||||||
|
|
||||||
@ -172,7 +179,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
|
|
||||||
starDifficulty.Value = ((float)normalDifficulty.Value.Stars, (float)moddedDifficulty.Value.Stars);
|
starDifficulty.Value = ((float)normalDifficulty.Value.Stars, (float)moddedDifficulty.Value.Stars);
|
||||||
}), starDifficultyCancellationSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current);
|
}), starDifficultyCancellationSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current);
|
||||||
}
|
});
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user