mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge pull request #24037 from cdwcgt/tournament-beatmapcache
Use beatmap cache to populate beatmap information in tournament client
This commit is contained in:
commit
719ac75ad2
@ -9,12 +9,14 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests;
|
||||
@ -35,6 +37,7 @@ namespace osu.Game.Tournament
|
||||
private TournamentStorage storage;
|
||||
private DependencyContainer dependencies;
|
||||
private FileBasedIPC ipc;
|
||||
private BeatmapLookupCache beatmapCache;
|
||||
|
||||
protected Task BracketLoadTask => bracketLoadTaskCompletionSource.Task;
|
||||
|
||||
@ -75,6 +78,8 @@ namespace osu.Game.Tournament
|
||||
Textures.AddTextureSource(new TextureLoaderStore(new StorageBackedResourceStore(storage)));
|
||||
|
||||
dependencies.CacheAs(new StableInfo(storage));
|
||||
|
||||
beatmapCache = dependencies.Get<BeatmapLookupCache>();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -241,9 +246,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID });
|
||||
API.Perform(req);
|
||||
b.Beatmap = new TournamentBeatmap(req.Response ?? new APIBeatmap());
|
||||
b.Beatmap = new TournamentBeatmap(beatmapCache.GetBeatmapAsync(b.ID).GetResultSafely() ?? new APIBeatmap());
|
||||
|
||||
updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
@ -268,9 +271,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID });
|
||||
API.Perform(req);
|
||||
b.Beatmap = new TournamentBeatmap(req.Response ?? new APIBeatmap());
|
||||
b.Beatmap = new TournamentBeatmap(beatmapCache.GetBeatmapAsync(b.ID).GetResultSafely() ?? new APIBeatmap());
|
||||
|
||||
updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user