Merge branch 'master' into net8

This commit is contained in:
Bartłomiej Dach 2024-02-02 16:27:32 +01:00 committed by GitHub
commit 8454f7a991
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 19 deletions

View File

@ -30,7 +30,7 @@ public abstract partial class OnlinePlayTestScene : ScreenTestScene, IOnlinePlay
/// <summary>
/// All dependencies required for online play components and screens.
/// </summary>
protected OnlinePlayTestSceneDependencies OnlinePlayDependencies => dependencies.OnlinePlayDependencies;
protected OnlinePlayTestSceneDependencies OnlinePlayDependencies => dependencies.OnlinePlayDependencies!;
protected override Container<Drawable> Content => content;
@ -48,12 +48,7 @@ protected OnlinePlayTestScene()
}
protected sealed override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
return dependencies = new DelegatedDependencyContainer(base.CreateChildDependencies(parent))
{
OnlinePlayDependencies = initDependencies()
};
}
=> dependencies = new DelegatedDependencyContainer(base.CreateChildDependencies(parent));
public override void SetUpSteps()
{
@ -62,7 +57,9 @@ public override void SetUpSteps()
AddStep("setup dependencies", () =>
{
// Reset the room dependencies to a fresh state.
dependencies.OnlinePlayDependencies = initDependencies();
dependencies.OnlinePlayDependencies = CreateOnlinePlayDependencies();
drawableDependenciesContainer.Clear();
drawableDependenciesContainer.AddRange(dependencies.OnlinePlayDependencies.DrawableComponents);
var handler = OnlinePlayDependencies.RequestsHandler;
@ -88,14 +85,6 @@ public override void SetUpSteps()
});
}
private OnlinePlayTestSceneDependencies initDependencies()
{
var newDependencies = CreateOnlinePlayDependencies();
drawableDependenciesContainer.Clear();
drawableDependenciesContainer.AddRange(newDependencies.DrawableComponents);
return newDependencies;
}
/// <summary>
/// Creates the room dependencies. Called every <see cref="SetUpSteps"/>.
/// </summary>
@ -112,7 +101,7 @@ private class DelegatedDependencyContainer : IReadOnlyDependencyContainer
/// <summary>
/// The online play dependencies.
/// </summary>
public OnlinePlayTestSceneDependencies OnlinePlayDependencies { get; set; } = null!;
public OnlinePlayTestSceneDependencies? OnlinePlayDependencies { get; set; }
private readonly IReadOnlyDependencyContainer parent;
private readonly DependencyContainer injectableDependencies;
@ -128,10 +117,10 @@ public DelegatedDependencyContainer(IReadOnlyDependencyContainer parent)
}
public object Get(Type type)
=> OnlinePlayDependencies.Get(type) ?? parent.Get(type);
=> OnlinePlayDependencies?.Get(type) ?? parent.Get(type);
public object Get(Type type, CacheInfo info)
=> OnlinePlayDependencies.Get(type, info) ?? parent.Get(type, info);
=> OnlinePlayDependencies?.Get(type, info) ?? parent.Get(type, info);
public void Inject<T>(T instance)
where T : class, IDependencyInjectionCandidate