Move App logic to other projects
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using static Zennysoft.Game.Ma.AppLogic.Input;
|
||||
using SimpleInjector;
|
||||
using SimpleInjector.Lifestyles;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Game.Ma.Implementation;
|
||||
using static Zennysoft.Game.Ma.Implementation.AppLogic.Input;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -35,9 +39,17 @@ public partial class App : CanvasLayer, IApp
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
var container = new SimpleInjector.Container();
|
||||
container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
|
||||
container.Register<IAppRepo, AppRepo>(Lifestyle.Singleton);
|
||||
container.Register<IAppLogic, AppLogic>(Lifestyle.Singleton);
|
||||
container.Verify();
|
||||
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
AppRepo = new AppRepo();
|
||||
AppLogic = new AppLogic();
|
||||
|
||||
AppRepo = container.GetInstance<IAppRepo>();
|
||||
AppLogic = container.GetInstance<IAppLogic>();
|
||||
|
||||
AppLogic.Set(AppRepo);
|
||||
AppLogic.Set(new AppLogic.Data());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user