/// <summary> /// 关闭所有窗口 /// </summary> public void CloseAllPanel() { if (mPanelStack == null) { mPanelStack = new Stack <BaseUI>(); } if (mPanelStack.Count <= 0) { return; } foreach (var key in mPanelDict.Keys) { if (mPanelDict[key].IsHotFix) { mPanelDict[key].ClearPanelBtn(); ObjectManager.Instance.ReleaseObject(mPanelDict[key].UIObj, 0, true, false); } else { GameObject.Destroy(mPanelDict[key].UIObj); } if (mPanelDict[key].IsHotFix) { ILRuntimeManager.Instance.AppDomainCtrl.Invoke(mPanelDict[key].HotFixClassName, "OnExit", mPanelDict[key]); } else { mPanelDict[key].OnExit(); } mPanelDict[key].ClearPanelBtn(); mPanelDict.Remove(key); mPanelStack.Pop(); if (mPanelStack.Count <= 0) { return; } BaseUI topPanel2 = mPanelStack.Peek(); if (topPanel2.IsHotFix) { ILRuntimeManager.Instance.AppDomainCtrl.Invoke(topPanel2.HotFixClassName, "OnResume", topPanel2); } else { topPanel2.OnResume(); } } }
/// <summary> /// 退出栈顶View /// </summary> public void PopPanel(bool destroy = false) { if (mPanelStack == null) { mPanelStack = new Stack <BaseUI>(); } if (mPanelStack.Count <= 0) { return; } mCurSiblingIndex--; //关闭栈顶页面的显示 BaseUI topPanel = mPanelStack.Pop(); if (topPanel.IsHotFix) { ILRuntimeManager.Instance.AppDomainCtrl.Invoke(topPanel.HotFixClassName, "OnExit", topPanel); } else { topPanel.OnExit(); } if (mPanelDict.ContainsKey(topPanel.PanelType)) { mPanelDict.Remove(topPanel.PanelType); } if (topPanel.IsHotFix) { if (destroy) { topPanel.ClearPanelBtn(); ObjectManager.Instance.ReleaseObject(topPanel.UIObj, 0, true); } else { ObjectManager.Instance.ReleaseObject(topPanel.UIObj, recycleParent: false); } } else { GameObject.Destroy(topPanel.UIObj); } topPanel.ClearData(); topPanel = null; if (mPanelStack.Count <= 0) { return; } BaseUI topPanel2 = mPanelStack.Peek(); if (topPanel2.IsHotFix) { ILRuntimeManager.Instance.AppDomainCtrl.Invoke(topPanel2.HotFixClassName, "OnResume", topPanel2); } else { topPanel2.OnResume(); } }