diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 6e4454a311..7bb0b95b9a 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -64,32 +64,36 @@ namespace osu.Game.Screens.Select public IEnumerable BeatmapSets { - get { return beatmapSets.Select(g => g.BeatmapSet); } - set + get => beatmapSets.Select(g => g.BeatmapSet); + set => loadBeatmapSets(() => value); + } + + public void LoadBeatmapSetsFromManager(BeatmapManager manager) => loadBeatmapSets(manager.GetAllUsableBeatmapSetsEnumerable); + + private void loadBeatmapSets(Func> beatmapSets) + { + CarouselRoot newRoot = new CarouselRoot(this); + + Task.Run(() => { - CarouselRoot newRoot = new CarouselRoot(this); + beatmapSets().Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); + newRoot.Filter(activeCriteria); - Task.Run(() => + // preload drawables as the ctor overhead is quite high currently. + var _ = newRoot.Drawables; + }).ContinueWith(_ => Schedule(() => + { + root = newRoot; + scrollableContent.Clear(false); + itemsCache.Invalidate(); + scrollPositionCache.Invalidate(); + + Schedule(() => { - value.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); - newRoot.Filter(activeCriteria); - - // preload drawables as the ctor overhead is quite high currently. - var _ = newRoot.Drawables; - }).ContinueWith(_ => Schedule(() => - { - root = newRoot; - scrollableContent.Clear(false); - itemsCache.Invalidate(); - scrollPositionCache.Invalidate(); - - Schedule(() => - { - BeatmapSetsChanged?.Invoke(); - initialLoadComplete = true; - }); - })); - } + BeatmapSetsChanged?.Invoke(); + initialLoadComplete = true; + }); + })); } private readonly List yPositions = new List(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ef03aff107..ac765c46ab 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Select sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty"); sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand"); - Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable(); + Carousel.LoadBeatmapSetsFromManager(this.beatmaps); } public void Edit(BeatmapInfo beatmap)