public void Close(string name) { //面板没有打开时 if (!panelDic.ContainsKey(name)) { return; } DSBasePanel panel = panelDic[name]; panel.OnClose(); panelDic.Remove(name); Object.Destroy(panel.panelObj); Object.Destroy(panel); }
public void Open <T>(params object[] para) where T : DSBasePanel { //面板已经打开时 string name = typeof(T).ToString(); if (panelDic.ContainsKey(name)) { return; } DSBasePanel panel = m_UIRoot.gameObject.AddComponent <T>(); panel.OnLoad(); panel.Load(); Transform parent = layerDic[panel.panelLayer]; panel.panelObj.transform.SetParent(parent, false); panelDic.Add(name, panel); panel.OnInitCmt(); panel.OnAction(); }