public static void OpenPanel(string _modules, string _panelName, int _layer, LuaTable _tab) { string key = _modules + "." + _panelName; if (panel_GOs.ContainsKey(key)) { GameObject go = panel_GOs[key]; go.transform.SetSiblingIndex(go.transform.parent.childCount - 1); go.SetActive(true); go.GetComponent <PanelBase> ().Open(); go.GetComponent <XLuaBehaviour> ().main.Get <Action <LuaTable> > ("onopen")(_tab); } else { string path = "/" + _modules + "/panels.assetbundle"; ABTool.LoadGO(path, _panelName, (_go) => { GameObject go = GameObject.Instantiate(_go); go.name = _go.name; go.transform.SetParent(canves_T.GetChild(_layer), false); go.transform.SetSiblingIndex(go.transform.parent.childCount - 1); go.GetComponent <PanelBase> ().Open(); go.GetComponent <XLuaBehaviour> ().main.Get <Action <LuaTable> > ("onopen")(_tab); panel_GOs[key] = go; }); } }
public static void InitPanel(string _modules, string _panelName, int _layer) { string key = _modules + "." + _panelName; if (panel_GOs.ContainsKey(key)) { Debug.LogWarningFormat("[PanelTool.InitPanel]已有此界面:{0}.{1}", _modules, _panelName); return; } string path = "/" + _modules + "/panels.assetbundle"; ABTool.LoadGO(path, _panelName, (_go) => { GameObject go = GameObject.Instantiate(_go); go.name = _go.name; go.transform.SetParent(canves_T.GetChild(_layer), false); panel_GOs[key] = go; go.SetActive(false); }); }