using Minesweeper.Config; using Minesweeper.Presentation.Views; using TMPro; using UnityEngine; using UnityEngine.UI; namespace Minesweeper.Presentation.Factories { public sealed class MinesweeperScreenBootstrapper { private const string MainMenuPanelName = "MainMenuPanel"; private const string BoardGridName = "BoardGrid"; private const string PausePanelName = "PausePanel"; private const string ResultPanelName = "ResultPanel"; private const string StartButtonPath = "StartButton"; private const string RestartButtonPath = "RestartButton"; private const string ContinueButtonPath = "ContinueButton"; private const string MainMenuButtonPath = "MainMenuButton"; private const string ResultTextPath = "ResultText"; public MinesweeperScreenRefs Spawn(Transform contentRoot, MinesweeperScreenCatalog catalog) { if (contentRoot == null) { Debug.LogError("Minesweeper screen bootstrap failed: Content root is not assigned."); return default; } if (catalog == null || !catalog.IsValid) { Debug.LogError("Minesweeper screen bootstrap failed: screen catalog prefab references are incomplete."); return default; } ClearContent(contentRoot); var mainMenu = SpawnScreen(catalog.MainMenuPanelPrefab, contentRoot, MainMenuPanelName, 0); var board = SpawnScreen(catalog.BoardGridPrefab, contentRoot, BoardGridName, 1); var pause = SpawnScreen(catalog.PausePanelPrefab, contentRoot, PausePanelName, 2); var result = SpawnScreen(catalog.ResultPanelPrefab, contentRoot, ResultPanelName, 3); var mainMenuView = RequireComponent(mainMenu.transform, MainMenuPanelName); mainMenuView.Bind(mainMenu, RequireChildComponent