♻️ Rebuild with DI
This commit is contained in:
23
Scripts/System/DependencyInjection.cs
Normal file
23
Scripts/System/DependencyInjection.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
using Container = SimpleInjector.Container;
|
||||
|
||||
namespace AceFieldNewHorizon.Scripts.System;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static Container Container { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Container = new Container();
|
||||
|
||||
// Register your system services here
|
||||
// As singletons, since they are typically unique global managers
|
||||
Container.RegisterSingleton<ResourceManager>();
|
||||
Container.RegisterSingleton<GridManager>();
|
||||
Container.RegisterSingleton(() => new BuildingRegistry("res://Data/Buildings.json"));
|
||||
|
||||
Container.Verify();
|
||||
GD.Print("[DI] Simple Injector container initialized and verified.");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user