using System; using UnityEngine; using UnityEngine.UI; namespace Vanguard.UI { /// Модальная заглушка раздела: заголовок, пояснение и «скоро». public sealed class ComingSoonOverlay { private readonly RectTransform _root; public ComingSoonOverlay( Transform parent, string name, string title, string note, Action onClose = null) { _root = UiKit.CreatePanel(parent, name, new Color(0f, 0f, 0f, 0.001f)); _root.GetComponent().raycastTarget = true; var panel = UiKit.CreateCenteredCard( _root, "Panel", new Vector2(720f, 420f), Color.white); panel.GetComponent().sprite = NeonUi.Body( 720, 420, 20, new Color(0.024f, 0.058f, 0.15f, 0.97f), new Color(0.18f, 0.49f, 1f, 0.85f), 2); panel.GetComponent().raycastTarget = true; var titleText = UiKit.CreateText( panel, "Title", title, 34, new Color(0.88f, 0.94f, 1f)); titleText.fontStyle = FontStyle.Bold; var titleRect = titleText.rectTransform; titleRect.anchorMin = new Vector2(0f, 1f); titleRect.anchorMax = new Vector2(1f, 1f); titleRect.pivot = new Vector2(0.5f, 1f); titleRect.sizeDelta = new Vector2(-64f, 56f); titleRect.anchoredPosition = new Vector2(0f, -34f); var noteText = UiKit.CreateText( panel, "Note", note, 18, new Color(0.60f, 0.70f, 0.88f), TextAnchor.UpperCenter); var noteRect = noteText.rectTransform; noteRect.anchorMin = new Vector2(0.5f, 0.5f); noteRect.anchorMax = new Vector2(0.5f, 0.5f); noteRect.pivot = new Vector2(0.5f, 0.5f); noteRect.sizeDelta = new Vector2(600f, 120f); noteRect.anchoredPosition = new Vector2(0f, 10f); StubUi.Badge(panel, new Vector2(-18f, -18f)); var close = UiKit.CreateButton(panel, "Close", "Закрыть", () => Close(), 18); var closeRect = close.GetComponent(); closeRect.anchorMin = new Vector2(0.5f, 0f); closeRect.anchorMax = new Vector2(0.5f, 0f); closeRect.pivot = new Vector2(0.5f, 0f); closeRect.sizeDelta = new Vector2(240f, 48f); closeRect.anchoredPosition = new Vector2(0f, 28f); if (onClose != null) close.onClick.AddListener(() => onClose()); _root.gameObject.SetActive(false); } public bool IsOpen => _root.gameObject.activeSelf; public void Show() => UiKit.SetActive(_root, true); public void Close() => UiKit.SetActive(_root, false); } }