[Fix] Rename Scripts Folder

This commit is contained in:
2026-06-07 00:30:10 +07:00
parent 79a928ae52
commit 6c9cdaf67d
140 changed files with 0 additions and 0 deletions
@@ -0,0 +1,34 @@
using System;
using Minesweeper.Presentation.Presenters;
using VContainer.Unity;
namespace Minesweeper.Infrastructure
{
public sealed class MinesweeperEntryPoint : IStartable, IDisposable
{
private readonly MainMenuPresenter mainMenuPresenter;
private readonly TopPanelPresenter topPanelPresenter;
private readonly GamePresenter gamePresenter;
public MinesweeperEntryPoint(MainMenuPresenter mainMenuPresenter, TopPanelPresenter topPanelPresenter, GamePresenter gamePresenter)
{
this.mainMenuPresenter = mainMenuPresenter;
this.topPanelPresenter = topPanelPresenter;
this.gamePresenter = gamePresenter;
}
public void Start()
{
topPanelPresenter.Initialize();
mainMenuPresenter.Initialize();
gamePresenter.Initialize();
}
public void Dispose()
{
gamePresenter.Dispose();
mainMenuPresenter.Dispose();
topPanelPresenter.Dispose();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5eae713b4d801be4996a70d4b630eeee
@@ -0,0 +1,158 @@
using Minesweeper.Commands;
using Minesweeper.Config;
using Minesweeper.Core;
using Minesweeper.ECS;
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;
[SerializeField] private MinesweeperUiConfig uiConfig;
[SerializeField] private MinesweeperScreenCatalog screenCatalog = new MinesweeperScreenCatalog();
[SerializeField] private Transform contentRoot;
[SerializeField] private TopPanelView topPanelView;
[SerializeField] private MainMenuView mainMenuView;
[SerializeField] private BoardView boardView;
[SerializeField] private PauseView pauseView;
[SerializeField] private ResultView resultView;
protected override void Configure(IContainerBuilder builder)
{
builder.RegisterInstance(GetConfig());
var resolvedUiConfig = GetUiConfig();
builder.RegisterInstance(resolvedUiConfig);
builder.Register<PlayerPrefsGameSettingsStorage>(Lifetime.Singleton).As<IGameSettingsStorage>();
builder.Register<GameSettingsService>(Lifetime.Singleton).As<IGameSettingsService>();
builder.Register<GameStateService>(Lifetime.Singleton).As<IGameStateService>();
builder.Register<BoardService>(Lifetime.Singleton).As<IBoardService>();
builder.Register<GamePauseService>(Lifetime.Singleton).As<IGamePauseService>();
builder.Register<GameTimerService>(Lifetime.Singleton).As<IGameTimerService>().As<ITickable>();
builder.Register<BoardEcsSyncService>(Lifetime.Singleton).As<IBoardEcsSyncService>();
builder.Register<GameReadModel>(Lifetime.Singleton).As<IGameReadModel>();
builder.Register<GameStateViewAdapter>(Lifetime.Singleton).As<IGameStateViewAdapter>();
builder.Register<CellViewFactory>(Lifetime.Singleton).As<ICellViewFactory>();
var screenRefs = SpawnScreens();
if (screenRefs.MainMenuView != null)
{
mainMenuView = screenRefs.MainMenuView;
}
if (screenRefs.BoardView != null)
{
boardView = screenRefs.BoardView;
}
if (screenRefs.PauseView != null)
{
pauseView = screenRefs.PauseView;
}
if (screenRefs.ResultView != null)
{
resultView = screenRefs.ResultView;
}
if (topPanelView != null)
{
topPanelView.BindConfig(resolvedUiConfig);
builder.RegisterComponent(topPanelView).As<ITopPanelView>();
}
else
{
builder.Register<NullTopPanelView>(Lifetime.Singleton).As<ITopPanelView>();
}
if (mainMenuView != null)
{
builder.RegisterComponent(mainMenuView).As<IMainMenuView>();
}
else
{
builder.Register<NullMainMenuView>(Lifetime.Singleton).As<IMainMenuView>();
}
if (boardView != null)
{
boardView.BindConfig(resolvedUiConfig);
builder.RegisterComponent(boardView).As<IBoardView>();
}
else
{
builder.Register<NullBoardView>(Lifetime.Singleton).As<IBoardView>();
}
if (pauseView != null)
{
builder.RegisterComponent(pauseView).As<IPauseView>();
}
else
{
builder.Register<NullPauseView>(Lifetime.Singleton).As<IPauseView>();
}
if (resultView != null)
{
builder.RegisterComponent(resultView).As<IResultView>();
}
else
{
builder.Register<NullResultView>(Lifetime.Singleton).As<IResultView>();
}
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<TopPanelPresenter>(Lifetime.Singleton);
builder.Register<GamePresenter>(Lifetime.Singleton);
builder.RegisterEntryPoint<MinesweeperEntryPoint>();
}
private MinesweeperGameConfig GetConfig()
{
if (gameConfig != null)
{
return gameConfig;
}
return ScriptableObject.CreateInstance<MinesweeperGameConfig>();
}
private MinesweeperUiConfig GetUiConfig()
{
if (uiConfig != null)
{
return uiConfig;
}
return ScriptableObject.CreateInstance<MinesweeperUiConfig>();
}
private MinesweeperScreenRefs SpawnScreens()
{
if (contentRoot == null || screenCatalog == null || !screenCatalog.IsValid)
{
return default;
}
return new MinesweeperScreenBootstrapper().Spawn(contentRoot, screenCatalog);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d4f9b0c2ad803d84382fbf03ba3096fa
@@ -0,0 +1,32 @@
using Minesweeper.Core;
using UnityEngine;
namespace Minesweeper.Infrastructure
{
public sealed class PlayerPrefsGameSettingsStorage : IGameSettingsStorage
{
private const string SizeXKey = "Minesweeper.Settings.SizeX";
private const string SizeYKey = "Minesweeper.Settings.SizeY";
private const string MinesCountKey = "Minesweeper.Settings.MinesCount";
public bool TryLoad(out GameSettingsValue value)
{
if (!PlayerPrefs.HasKey(SizeXKey) || !PlayerPrefs.HasKey(SizeYKey) || !PlayerPrefs.HasKey(MinesCountKey))
{
value = default;
return false;
}
value = new GameSettingsValue(PlayerPrefs.GetInt(SizeXKey), PlayerPrefs.GetInt(SizeYKey), PlayerPrefs.GetInt(MinesCountKey));
return true;
}
public void Save(GameSettingsValue value)
{
PlayerPrefs.SetInt(SizeXKey, value.SizeX);
PlayerPrefs.SetInt(SizeYKey, value.SizeY);
PlayerPrefs.SetInt(MinesCountKey, value.MinesCount);
PlayerPrefs.Save();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a001fc2e924d95643a075190b6cadda1