[Add] Basic project architecture

This commit is contained in:
2026-06-06 20:53:30 +07:00
parent 9ebedb12ec
commit 8ed9cc655f
79 changed files with 1080 additions and 9 deletions
@@ -0,0 +1,30 @@
using System;
using Minesweeper.Presentation.Presenters;
using VContainer.Unity;
namespace Minesweeper.Infrastructure
{
public sealed class MinesweeperEntryPoint : IStartable, IDisposable
{
private readonly MainMenuPresenter mainMenuPresenter;
private readonly GamePresenter gamePresenter;
public MinesweeperEntryPoint(MainMenuPresenter mainMenuPresenter, GamePresenter gamePresenter)
{
this.mainMenuPresenter = mainMenuPresenter;
this.gamePresenter = gamePresenter;
}
public void Start()
{
mainMenuPresenter.Initialize();
gamePresenter.Initialize();
}
public void Dispose()
{
gamePresenter.Dispose();
mainMenuPresenter.Dispose();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5eae713b4d801be4996a70d4b630eeee
@@ -0,0 +1,54 @@
using Minesweeper.Commands;
using Minesweeper.Config;
using Minesweeper.Core;
using Minesweeper.Presentation.Adapters;
using Minesweeper.Presentation.Factories;
using Minesweeper.Presentation.Presenters;
using Minesweeper.Presentation.ReadModels;
using Minesweeper.Presentation.Views;
using UnityEngine;
using VContainer;
using VContainer.Unity;
namespace Minesweeper.Infrastructure
{
public sealed class MinesweeperLifetimeScope : LifetimeScope
{
[SerializeField] private MinesweeperGameConfig gameConfig;
protected override void Configure(IContainerBuilder builder)
{
builder.RegisterInstance(GetConfig());
builder.Register<GameStateService>(Lifetime.Singleton).As<IGameStateService>();
builder.Register<GameReadModel>(Lifetime.Singleton).As<IGameReadModel>();
builder.Register<GameStateViewAdapter>(Lifetime.Singleton).As<IGameStateViewAdapter>();
builder.Register<CellViewFactory>(Lifetime.Singleton).As<ICellViewFactory>();
builder.Register<NullMainMenuView>(Lifetime.Singleton).As<IMainMenuView>();
builder.Register<NullGameView>(Lifetime.Singleton).As<IGameView>();
builder.Register<SelectFieldCommandHandler>(Lifetime.Singleton);
builder.Register<StartGameCommandHandler>(Lifetime.Singleton);
builder.Register<OpenCellCommandHandler>(Lifetime.Singleton);
builder.Register<ToggleFlagCommandHandler>(Lifetime.Singleton);
builder.Register<RestartCommandHandler>(Lifetime.Singleton);
builder.Register<PauseCommandHandler>(Lifetime.Singleton);
builder.Register<ResumeCommandHandler>(Lifetime.Singleton);
builder.Register<GoToMenuCommandHandler>(Lifetime.Singleton);
builder.Register<GameCommandDispatcher>(Lifetime.Singleton).As<IGameCommandDispatcher>();
builder.Register<MainMenuPresenter>(Lifetime.Singleton);
builder.Register<GamePresenter>(Lifetime.Singleton);
builder.RegisterEntryPoint<MinesweeperEntryPoint>();
}
private MinesweeperGameConfig GetConfig()
{
if (gameConfig != null)
{
return gameConfig;
}
return ScriptableObject.CreateInstance<MinesweeperGameConfig>();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d4f9b0c2ad803d84382fbf03ba3096fa