using System; using System.Collections.Generic; using UnityEngine; using Object = UnityEngine.Object; namespace TyphoonUI { /// /// UI实例 /// [ExecuteInEditMode] public class UIObject : MonoBehaviour { public static event Action OnInvokeAwake = null; public static event Action OnInvokeDestroy = null; /*命名空间*/ public string NameSpace; /*节点元素*/ public List Nodes = new List(); /// /// 创建view /// public T CreateView(ref T t) where T : IInitializeView, new() { if (t == null) { t = new T(); t.InitializeView(this); } return t; } protected virtual void Awake() { #if UNITY_EDITOR // Debug.Log($"UIObject被创建 {name}"); OnInvokeAwake?.Invoke(this); #endif } protected virtual void OnDestroy() { #if UNITY_EDITOR // Debug.Log($"UIObject被销毁 {name}"); OnInvokeDestroy?.Invoke(this); #endif } } }