using System.Collections.Generic; using ETModel; using UnityEngine; namespace ETHotfix { [ObjectSystem] public class UIComponentAwakeSystem : AwakeSystem { public override void Awake(UIComponent self) { self.Camera = GameObject.Find("/Global/Camera/UICamera"); } } /// /// 管理所有UI /// public class UIComponent: Component { public GameObject Camera; public Dictionary uis = new Dictionary(); public void Add(UI ui) { ui.GameObject.GetComponent().worldCamera = this.Camera.GetComponent(); this.uis.Add(ui.Name, ui); ui.Parent = this; } public void Remove(string name) { if (!this.uis.TryGetValue(name, out UI ui)) { return; } this.uis.Remove(name); ui.Dispose(); } } }