mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Merge pull request #11897 from peppy/fix-song-select-star-rating-display-zero-flashing
Fix the star rating display at song select flashing to zero when changing mods
This commit is contained in:
commit
8e12dd98f9
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -138,8 +139,6 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
updateStarDifficulty();
|
updateStarDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBindable<StarDifficulty> normalStarDifficulty;
|
|
||||||
private IBindable<StarDifficulty> moddedStarDifficulty;
|
|
||||||
private CancellationTokenSource starDifficultyCancellationSource;
|
private CancellationTokenSource starDifficultyCancellationSource;
|
||||||
|
|
||||||
private void updateStarDifficulty()
|
private void updateStarDifficulty()
|
||||||
@ -151,13 +150,13 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
|
|
||||||
starDifficultyCancellationSource = new CancellationTokenSource();
|
starDifficultyCancellationSource = new CancellationTokenSource();
|
||||||
|
|
||||||
normalStarDifficulty = difficultyCache.GetBindableDifficulty(Beatmap, ruleset.Value, null, starDifficultyCancellationSource.Token);
|
var normalStarDifficulty = difficultyCache.GetDifficultyAsync(Beatmap, ruleset.Value, null, starDifficultyCancellationSource.Token);
|
||||||
moddedStarDifficulty = difficultyCache.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
var moddedStarDifficulty = difficultyCache.GetDifficultyAsync(Beatmap, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||||
|
|
||||||
normalStarDifficulty.BindValueChanged(_ => updateDisplay());
|
Task.WhenAll(normalStarDifficulty, moddedStarDifficulty).ContinueWith(_ => Schedule(() =>
|
||||||
moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true);
|
{
|
||||||
|
starDifficulty.Value = ((float)normalStarDifficulty.Result.Stars, (float)moddedStarDifficulty.Result.Stars);
|
||||||
void updateDisplay() => starDifficulty.Value = ((float)normalStarDifficulty.Value.Stars, (float)moddedStarDifficulty.Value.Stars);
|
}), 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