using System.Collections.Generic; using UnityEngine; namespace XericUI.Form { /// /// 窗口数据描述对象 — 由 UIFormManager 创建和持有。 /// 描述一个窗口实例的标识信息、运行时引用、显示状态和层级关系。 /// public class WindowEntry { #region 基本标识 /// 唯一 ID(GUID) public string Id { get; } /// 窗口标题 public string Title; /// 窗口图标(任务栏和标题栏使用) public Sprite Icon; /// 任务栏图标着色 public Color TintColor = Color.white; #endregion #region 实例引用 /// 运行时窗口实例 public UIFormController Controller; /// 窗口预制体引用 public RectTransform Prefab; #endregion #region 显示状态 /// 当前窗口状态 public WindowState State; /// 是否在任务栏上显示图标 public bool ShowInTaskBar = true; #endregion #region 层级关系 /// 父窗口 Entry(关闭父窗口时级联关闭子窗口) public WindowEntry ParentEntry { get; private set; } /// 子窗口 Entry 列表 public readonly List ChildEntries = new List(); /// 添加子窗口依赖 public void AddChild(WindowEntry child) { if (child == null || ChildEntries.Contains(child)) return; child.ParentEntry = this; ChildEntries.Add(child); } /// 移除子窗口依赖 public void RemoveChild(WindowEntry child) { if (child == null) return; child.ParentEntry = null; ChildEntries.Remove(child); } #endregion #region 进度 /// 任务栏进度 (0-1) public float Progress; /// 是否在任务栏显示进度条 public bool ShowProgress; #endregion #region 构造 public WindowEntry(string id) { Id = id ?? System.Guid.NewGuid().ToString(); } public WindowEntry() : this(null) { } #endregion } #region 委托 /// 窗口 Entry 事件委托 public delegate void WindowEntryEventHandler(WindowEntry entry); #endregion }