using Minesweeper.Config; using Minesweeper.Core; using Minesweeper.Presentation.Views; using TMPro; using UnityEngine; using UnityEngine.UI; namespace Minesweeper.Presentation.Factories { public sealed class CellViewFactory : ICellViewFactory { private const string ContentImagePath = "Content/Image"; private const string ContentLabelPath = "Content/Text (TMP)"; private readonly MinesweeperUiConfig uiConfig; public CellViewFactory(MinesweeperUiConfig uiConfig) { this.uiConfig = uiConfig; } public CellView CreateCell(BoardCellData cell, Transform parent) { var prefab = uiConfig.CellButtonPrefab; var go = prefab != null ? Object.Instantiate(prefab, parent) : CreateFallbackCell(parent); go.name = BuildCellName(cell.X, cell.Y, cell.DisplayValue); var view = go.GetComponent(); if (view == null) { view = go.AddComponent(); } var button = go.GetComponent