mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 22:19:30 +08:00
Offload database query to task
Allows song select to load a touch faster, in theory.
This commit is contained in:
parent
e8cc3294d7
commit
a28e71995d
@ -241,7 +241,13 @@ namespace osu.Game.Beatmaps
|
|||||||
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
public List<BeatmapSetInfo> GetAllUsableBeatmapSets() => beatmaps.ConsumableItems.Where(s => !s.DeletePending && !s.Protected).ToList();
|
public List<BeatmapSetInfo> GetAllUsableBeatmapSets() => GetAllUsableBeatmapSetsEnumerable().ToList();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
|
||||||
|
public IQueryable<BeatmapSetInfo> GetAllUsableBeatmapSetsEnumerable() => beatmaps.ConsumableItems.Where(s => !s.DeletePending && !s.Protected);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -63,8 +62,6 @@ namespace osu.Game.Screens.Select
|
|||||||
private SampleChannel sampleChangeDifficulty;
|
private SampleChannel sampleChangeDifficulty;
|
||||||
private SampleChannel sampleChangeBeatmap;
|
private SampleChannel sampleChangeBeatmap;
|
||||||
|
|
||||||
private CancellationTokenSource initialAddSetsTask;
|
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
@ -207,9 +204,7 @@ namespace osu.Game.Screens.Select
|
|||||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||||
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
||||||
|
|
||||||
initialAddSetsTask = new CancellationTokenSource();
|
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
|
||||||
|
|
||||||
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets();
|
|
||||||
|
|
||||||
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
||||||
Beatmap.TriggerChange();
|
Beatmap.TriggerChange();
|
||||||
@ -417,8 +412,6 @@ namespace osu.Game.Screens.Select
|
|||||||
beatmaps.BeatmapHidden -= onBeatmapHidden;
|
beatmaps.BeatmapHidden -= onBeatmapHidden;
|
||||||
beatmaps.BeatmapRestored -= onBeatmapRestored;
|
beatmaps.BeatmapRestored -= onBeatmapRestored;
|
||||||
}
|
}
|
||||||
|
|
||||||
initialAddSetsTask?.Cancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user