mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Rework how notifications are distributed
This commit is contained in:
parent
57d45b180c
commit
df5094c0d4
@ -49,14 +49,18 @@ namespace osu.Game.Beatmaps
|
||||
private readonly FileStore files;
|
||||
|
||||
private readonly RulesetStore rulesets;
|
||||
private readonly Action<Notification> postNotification;
|
||||
|
||||
private readonly BeatmapStore beatmaps;
|
||||
|
||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
||||
private BeatmapIPCChannel ipc;
|
||||
|
||||
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null, Action<Notification> postNotification = null)
|
||||
/// <summary>
|
||||
/// Set an endpoint for notifications to be posted to.
|
||||
/// </summary>
|
||||
public Action<Notification> PostNotification { private get; set; }
|
||||
|
||||
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null)
|
||||
{
|
||||
beatmaps = new BeatmapStore(connection);
|
||||
beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s);
|
||||
@ -65,7 +69,6 @@ namespace osu.Game.Beatmaps
|
||||
this.storage = storage;
|
||||
this.files = files;
|
||||
this.rulesets = rulesets;
|
||||
this.postNotification = postNotification;
|
||||
|
||||
if (importHost != null)
|
||||
ipc = new BeatmapIPCChannel(importHost, this);
|
||||
@ -85,7 +88,7 @@ namespace osu.Game.Beatmaps
|
||||
State = ProgressNotificationState.Active,
|
||||
};
|
||||
|
||||
postNotification?.Invoke(notification);
|
||||
PostNotification?.Invoke(notification);
|
||||
|
||||
int i = 0;
|
||||
foreach (string path in paths)
|
||||
|
@ -149,6 +149,9 @@ namespace osu.Game
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// hook up notifications to components.
|
||||
BeatmapManager.PostNotification = n => notificationOverlay?.Post(n);
|
||||
|
||||
AddRange(new Drawable[] {
|
||||
new VolumeControlReceptor
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace osu.Game
|
||||
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(connection));
|
||||
dependencies.Cache(FileStore = new FileStore(connection, Host.Storage));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host, PostNotification));
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host));
|
||||
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager));
|
||||
dependencies.Cache(new OsuColour());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user