feat: working version with scopes.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Godot;
|
||||
using GodotHostTest.GodotDI;
|
||||
using GodotHostTest.Interfaces;
|
||||
using OwofGames.GodotLume;
|
||||
|
||||
namespace GodotHostTest.Game;
|
||||
|
||||
@@ -7,10 +9,9 @@ public partial class LevelServiceSource : ServiceSource
|
||||
{
|
||||
[Export] private TargetSpawner _targetSpawner = null!;
|
||||
|
||||
// protected override void ConfigureServices(IServiceCollection serviceCollection)
|
||||
// {
|
||||
// serviceCollection
|
||||
// .AddSingleton<ITargetCollector>(_targetSpawner)
|
||||
// .AddSingleton<ITargetSpawner>(_targetSpawner);
|
||||
// }
|
||||
protected override void OnScopeCreated(IProvider serviceProvider)
|
||||
{
|
||||
serviceProvider.Get<IValueSetter<ITargetCollector>>().Set(_targetSpawner);
|
||||
serviceProvider.Get<IValueSetter<ITargetSpawner>>().Set(_targetSpawner);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user