1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

Add new IDependencyInjectionCandidate interface to non-drawable cached classes

This commit is contained in:
Dean Herbert 2022-11-29 14:45:26 +09:00
parent b5b79e09e4
commit 61c702c02e
5 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ using osu.Game.Online.Rooms.RoomStatuses;
namespace osu.Game.Online.Rooms
{
[JsonObject(MemberSerialization.OptIn)]
public partial class Room
public partial class Room : IDependencyInjectionCandidate
{
[Cached]
[JsonProperty("id")]

View File

@ -233,7 +233,7 @@ namespace osu.Game.Overlays.FirstRunSetup
return parentDependencies.Get(type, info);
}
public void Inject<T>(T instance) where T : class
public void Inject<T>(T instance) where T : class, IDependencyInjectionCandidate
{
parentDependencies.Inject(instance);
}

View File

@ -164,7 +164,7 @@ namespace osu.Game.Tests.Beatmaps
return fallback.Get(type, info);
}
public void Inject<T>(T instance) where T : class
public void Inject<T>(T instance) where T : class, IDependencyInjectionCandidate
{
// Never used directly
}

View File

@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
=> OnlinePlayDependencies?.Get(type, info) ?? parent.Get(type, info);
public void Inject<T>(T instance)
where T : class
where T : class, IDependencyInjectionCandidate
=> injectableDependencies.Inject(instance);
}
}

View File

@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
=> dependencies.Get(type, info);
public void Inject<T>(T instance)
where T : class
where T : class, IDependencyInjectionCandidate
=> dependencies.Inject(instance);
protected void Cache(object instance)