mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 09:42:55 +08:00
Move BeatmapOnlineLookupQueue
to inside BeatmapUpdater
This commit is contained in:
parent
ef42c6ecdf
commit
0698471627
@ -41,7 +41,6 @@ namespace osu.Game.Beatmaps
|
|||||||
private readonly BeatmapImporter beatmapImporter;
|
private readonly BeatmapImporter beatmapImporter;
|
||||||
|
|
||||||
private readonly WorkingBeatmapCache workingBeatmapCache;
|
private readonly WorkingBeatmapCache workingBeatmapCache;
|
||||||
private readonly BeatmapOnlineLookupQueue? onlineBeatmapLookupQueue;
|
|
||||||
private readonly BeatmapUpdater? beatmapUpdater;
|
private readonly BeatmapUpdater? beatmapUpdater;
|
||||||
|
|
||||||
public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost? host = null,
|
public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost? host = null,
|
||||||
@ -56,8 +55,7 @@ namespace osu.Game.Beatmaps
|
|||||||
if (difficultyCache == null)
|
if (difficultyCache == null)
|
||||||
throw new ArgumentNullException(nameof(difficultyCache), "Difficulty cache must be provided if online lookups are required.");
|
throw new ArgumentNullException(nameof(difficultyCache), "Difficulty cache must be provided if online lookups are required.");
|
||||||
|
|
||||||
onlineBeatmapLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
beatmapUpdater = new BeatmapUpdater(this, difficultyCache, api, storage);
|
||||||
beatmapUpdater = new BeatmapUpdater(this, onlineBeatmapLookupQueue, difficultyCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var userResources = new RealmFileStore(realm, storage).Store;
|
var userResources = new RealmFileStore(realm, storage).Store;
|
||||||
@ -474,7 +472,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
onlineBeatmapLookupQueue?.Dispose();
|
beatmapUpdater?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using Realms;
|
using Realms;
|
||||||
|
|
||||||
@ -13,17 +17,18 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles all processing required to ensure a local beatmap is in a consistent state with any changes.
|
/// Handles all processing required to ensure a local beatmap is in a consistent state with any changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BeatmapUpdater
|
public class BeatmapUpdater : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IWorkingBeatmapCache workingBeatmapCache;
|
private readonly IWorkingBeatmapCache workingBeatmapCache;
|
||||||
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
||||||
private readonly BeatmapDifficultyCache difficultyCache;
|
private readonly BeatmapDifficultyCache difficultyCache;
|
||||||
|
|
||||||
public BeatmapUpdater(IWorkingBeatmapCache workingBeatmapCache, BeatmapOnlineLookupQueue onlineLookupQueue, BeatmapDifficultyCache difficultyCache)
|
public BeatmapUpdater(IWorkingBeatmapCache workingBeatmapCache, BeatmapDifficultyCache difficultyCache, IAPIProvider api, Storage storage)
|
||||||
{
|
{
|
||||||
this.workingBeatmapCache = workingBeatmapCache;
|
this.workingBeatmapCache = workingBeatmapCache;
|
||||||
this.onlineLookupQueue = onlineLookupQueue;
|
|
||||||
this.difficultyCache = difficultyCache;
|
this.difficultyCache = difficultyCache;
|
||||||
|
|
||||||
|
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,5 +86,15 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
return endTime - startTime;
|
return endTime - startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Implementation of IDisposable
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (onlineLookupQueue.IsNotNull())
|
||||||
|
onlineLookupQueue.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user