public BasePanel ShowPanel(string panelName) { BasePanel panel = GetPanel(panelName); if (panel != null) { panel.ShowPanel(null); } else { panel = LoadPanel(panelName); panel.ShowPanel(null); } return(panel); }
public T ShowPanel <T>(object obj = null) where T : BasePanel { T t = GetPanel <T>(); if (t != null) { t.ShowPanel(obj); } else { string panelName = typeof(T).Name; BasePanel bp = LoadPanel(panelName); if (bp != null) { bp.ShowPanel(obj); return(bp as T); } } return(t); }
public T GetPanel <T>() where T : BasePanel { BasePanel panel = GetPanel(typeof(T).Name); if (panel != null) { return(panel as T); } else { string panelName = typeof(T).Name; BasePanel bp = LoadPanel(panelName); if (bp != null) { return(bp as T); } } return(null); }
BasePanel InstantiateObj(string panelName) { GameObject obj = GetGameObjectByPanelName(panelName); Debug.Log("load ui panel " + obj.name); if (obj == null) { return(null); } GameObject go = GameObject.Instantiate(obj) as GameObject; go.name = panelName; BasePanel bp = go.GetComponent <BasePanel>(); if (bp == null) { go.AddComponent <BasePanel>(); } return(bp); }