mirror of
https://github.com/ppy/osu.git
synced 2026-05-16 18:38:32 +08:00
Move realm collection retrieval to exist beside beatmap retrieval for organisation
This commit is contained in:
@@ -52,9 +52,6 @@ namespace osu.Game.Screens.SelectV2
|
||||
private readonly BeatmapCarouselFilterMatching matching;
|
||||
private readonly BeatmapCarouselFilterGrouping grouping;
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of beatmap difficulties displayed with the filter.
|
||||
/// </summary>
|
||||
@@ -102,17 +99,18 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
matching = new BeatmapCarouselFilterMatching(() => Criteria!),
|
||||
new BeatmapCarouselFilterSorting(() => Criteria!),
|
||||
grouping = new BeatmapCarouselFilterGrouping(() => Criteria!, () => realm.Run(r => r.All<BeatmapCollection>().AsEnumerable().Detach())),
|
||||
grouping = new BeatmapCarouselFilterGrouping(() => Criteria!, () => detachedCollections())
|
||||
};
|
||||
|
||||
AddInternal(loading = new LoadingLayer());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapStore beatmapStore, AudioManager audio, OsuConfigManager config, CancellationToken? cancellationToken)
|
||||
private void load(BeatmapStore beatmapStore, RealmAccess realm, AudioManager audio, OsuConfigManager config, CancellationToken? cancellationToken)
|
||||
{
|
||||
setupPools();
|
||||
detachedBeatmaps = beatmapStore.GetBeatmapSets(cancellationToken);
|
||||
detachedCollections = () => realm.Run(r => r.All<BeatmapCollection>().AsEnumerable().Detach());
|
||||
loadSamples(audio);
|
||||
|
||||
config.BindWith(OsuSetting.RandomSelectAlgorithm, randomAlgorithm);
|
||||
@@ -700,6 +698,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
private Sample? spinSample;
|
||||
private Sample? randomSelectSample;
|
||||
|
||||
private Func<List<BeatmapCollection>> detachedCollections = null!;
|
||||
|
||||
public bool NextRandom()
|
||||
{
|
||||
var carouselItems = GetCarouselItems();
|
||||
|
||||
Reference in New Issue
Block a user