♻️ Rebuild with DI

This commit is contained in:
2025-08-31 01:44:18 +08:00
parent 1cc941d893
commit c72353716f
13 changed files with 95 additions and 36 deletions

View 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.");
}
}