public void OnDestroy() { UnRegister(); Destroy(); m_data = null; m_luacode = null; m_handler = null; }
/// <summary> /// 需要的初始化 /// </summary> /// <param name="args"></param> public void Initialization(object[] args, PanelCompleteHandler handler = null) { Init(); m_data = args; if (m_luacode != null) { m_luacode.uiData = m_data; } m_handler = handler; }
/// <summary> /// 刷新 /// </summary> /// <param name="args"></param> public void Refresh(object[] args, PanelCompleteHandler handler = null) { m_data = args; m_handler = handler; if (m_luacode != null) { m_luacode.uiData = m_data; m_luacode.UnRegister(); } UnRegister(); Start(); }
public static void OpenPanelAsync(string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, params object[] args) { UIBase ui = null; if (m_panels.TryGetValue(uiName, out ui)) { ui.gameObject.SetActive(true); SetPanelDepth(ui, ismaxDepth); ui.Refresh(args, handler); return; } Instance.StartCoroutine(Instance.LoadPanelAsync(uiName, ismaxDepth, handler, args)); }
public void OnDestroy() { if (m_luacode != null && !LuaManager.isDispose) { m_luacode.UnRegister(); } UnRegister(); if (m_luacode != null && !LuaManager.isDispose) { m_luacode.Destroy(); } Destroy(); m_data = null; m_luacode = null; m_handler = null; }
private IEnumerator LoadPanelAsync(string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, object[] args = null) { //string uipath = string.Format("ui/{0}.bundle", uiName.ToLower()); string uipath = uiName.ToLower(); var request = AssetBundleManager.LoadAssetAsync(uipath, uiName, typeof(GameObject)); m_assetOps.Add(request); yield return(request); GameObject prefab = request.GetAsset <GameObject>(); if (prefab != null) { GameObject go = Instantiate(prefab) as GameObject; SetPanel(go, uiName, ismaxDepth, handler, args); } yield break; }
private static UIBase SetPanel(GameObject go, string uiName, bool ismaxDepth = false, PanelCompleteHandler handler = null, object[] args = null) { go.SetActive(true); Transform tparent = Main.GetUIRoot().FindChild("Camera"); go.transform.SetParent(tparent); if (!GUIManager.m_panelExitList.ContainsKey(uiName)) { GUIManager.m_panelExitList.Add(uiName, go); } bool nocshape = false; var type = Assembly.GetExecutingAssembly().GetType(uiName); if (type == null) { nocshape = true; type = typeof(UIBase); } UIBase ui = go.GetComponent(type) as UIBase; if (ui == null) { ui = go.AddComponent(type) as UIBase; } m_panels.Add(uiName, ui); go.transform.localScale = Vector3.one; go.transform.localPosition = Vector3.zero; if (ui != null) { go.GetComponent <UIPanel>().depth = ui.setDepth; ui.nocshape = nocshape; ui.Initialization(args, handler); } else { } return(ui); }