mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-02 22:31:10 +00:00
init: add project
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using _Project.Develop.Runtime.Entities;
|
||||
using _Project.Develop.Runtime.UI;
|
||||
using _Project.Develop.Runtime.UI.Core;
|
||||
using _Project.Develop.Runtime.UI.Screens.Gameplay;
|
||||
using Assets._Project.Develop.Runtime.Infrastructure.DI;
|
||||
using Assets._Project.Develop.Runtime.Utilities.AssetsManagement;
|
||||
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets._Project.Develop.Runtime.Gameplay.Infrastructure
|
||||
{
|
||||
public class GameplayContextRegistrations
|
||||
{
|
||||
public static void Process(DIContainer container)
|
||||
{
|
||||
// container.RegisterAsSingle(CreateGameplayUIRoot).NonLazy();
|
||||
// container.RegisterAsSingle(CreateGameplayScreenPresenter).NonLazy();
|
||||
// container.RegisterAsSingle(CreateGameplayPresentersFactory);
|
||||
// container.RegisterAsSingle(CreateGameplayPopupService);
|
||||
|
||||
container.RegisterAsSingle(CreateEntitiesFactory);
|
||||
container.RegisterAsSingle(CreateEntitiesLifeContext);
|
||||
container.RegisterAsSingle(CreateCollidersRegistryService);
|
||||
container.RegisterAsSingle(CreateMonoEntitiesFactory).NonLazy();
|
||||
}
|
||||
|
||||
private static EntitiesLifeContext CreateEntitiesLifeContext(DIContainer c) => new();
|
||||
|
||||
private static EntitiesFactory CreateEntitiesFactory(DIContainer c) => new(c);
|
||||
|
||||
private static GameplayPresentersFactory CreateGameplayPresentersFactory(DIContainer c) => new(c);
|
||||
|
||||
private static CollidersRegistryService CreateCollidersRegistryService(DIContainer c) => new();
|
||||
|
||||
private static GameplayPopupService CreateGameplayPopupService(DIContainer c)
|
||||
{
|
||||
return new GameplayPopupService(
|
||||
c.Resolve<ViewsFactory>(),
|
||||
c.Resolve<ProjectPresentersFactory>(),
|
||||
c.Resolve<GameplayUIRoot>(),
|
||||
c.Resolve<GameplayPresentersFactory>());
|
||||
}
|
||||
|
||||
private static GameplayUIRoot CreateGameplayUIRoot(DIContainer c)
|
||||
{
|
||||
ResourcesAssetsLoader loader = c.Resolve<ResourcesAssetsLoader>();
|
||||
GameplayUIRoot uiRootPrefab = loader.Load<GameplayUIRoot>(PathToResources.UI.Screens.Gameplay);
|
||||
|
||||
return Object.Instantiate(uiRootPrefab);
|
||||
}
|
||||
|
||||
private static GameplayScreenPresenter CreateGameplayScreenPresenter(DIContainer c)
|
||||
{
|
||||
GameplayUIRoot uiRoot = c.Resolve<GameplayUIRoot>();
|
||||
GameplayScreenView view = c.Resolve<ViewsFactory>().Create<GameplayScreenView>(uiRoot.HUDLayer);
|
||||
|
||||
return c.Resolve<GameplayPresentersFactory>().CreateGameplayScreenPresenter(view);
|
||||
}
|
||||
|
||||
private static MonoEntitiesFactory CreateMonoEntitiesFactory(DIContainer c)
|
||||
{
|
||||
return new MonoEntitiesFactory(
|
||||
c.Resolve<ResourcesAssetsLoader>(),
|
||||
c.Resolve<EntitiesLifeContext>(),
|
||||
c.Resolve<CollidersRegistryService>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user