Allow determining a BeatmapDifficultyCache's bindable return's completion state via nullability

This commit is contained in:
Dean Herbert
2021-02-25 16:19:01 +09:00
parent 9f3ceb99eb
commit 03771ce8ec
5 changed files with 23 additions and 12 deletions

View File

@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select.Carousel
[Resolved(CanBeNull = true)]
private ManageCollectionsDialog manageCollectionsDialog { get; set; }
private IBindable<StarDifficulty> starDifficultyBindable;
private IBindable<StarDifficulty?> starDifficultyBindable;
private CancellationTokenSource starDifficultyCancellationSource;
public DrawableCarouselBeatmap(CarouselBeatmap panel)
@ -217,7 +217,10 @@ namespace osu.Game.Screens.Select.Carousel
{
// We've potentially cancelled the computation above so a new bindable is required.
starDifficultyBindable = difficultyCache.GetBindableDifficulty(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token);
starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true);
starDifficultyBindable.BindValueChanged(d =>
{
starCounter.Current = (float)(d.NewValue?.Stars ?? 0);
}, true);
}
base.ApplyState();