Files
project-entity/Assets/_Project/Develop/Runtime/Logic/Meta/Infrastructure/MainMenuContextRegistrations.cs
2026-02-18 23:02:28 +05:00

49 lines
2.0 KiB
C#

using _Project.Develop.Runtime.UI;
using _Project.Develop.Runtime.UI.Core;
using _Project.Develop.Runtime.UI.Screens.MainMenu;
using Assets._Project.Develop.Runtime.Infrastructure.DI;
using Assets._Project.Develop.Runtime.Utilities.AssetsManagement;
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
using Object = UnityEngine.Object;
namespace Assets._Project.Develop.Runtime.Meta.Infrastructure
{
public class MainMenuContextRegistrations
{
public static void Process(DIContainer container)
{
container.RegisterAsSingle(CreateMainMenuUIRoot).NonLazy();
container.RegisterAsSingle(CreateMainMenuPresentersFactory);
container.RegisterAsSingle(CreateMainMenuScreenPresenter).NonLazy();
container.RegisterAsSingle(CreateMainMenuPopupService);
}
private static MainMenuPresentersFactory CreateMainMenuPresentersFactory(DIContainer c) => new(c);
private static MainMenuPopupService CreateMainMenuPopupService(DIContainer c)
{
return new MainMenuPopupService(
c.Resolve<ViewsFactory>(),
c.Resolve<ProjectPresentersFactory>(),
c.Resolve<MainMenuUIRoot>());
}
private static MainMenuUIRoot CreateMainMenuUIRoot(DIContainer c)
{
ResourcesAssetsLoader loader = c.Resolve<ResourcesAssetsLoader>();
MainMenuUIRoot uiRootPrefab = loader.Load<MainMenuUIRoot>(PathToResources.UI.Screens.MainMenu);
return Object.Instantiate(uiRootPrefab);
}
private static MainMenuScreenPresenter CreateMainMenuScreenPresenter(DIContainer c)
{
MainMenuUIRoot uiRoot = c.Resolve<MainMenuUIRoot>();
MainMenuScreenView view = c.Resolve<ViewsFactory>().Create<MainMenuScreenView>(uiRoot.HUDLayer);
MainMenuScreenPresenter presenter = c.Resolve<MainMenuPresentersFactory>().CreateMainMenuScreen(view);
return presenter;
}
}
}