public void ClosePanel(UIPanelTypes panelType) { BasePanel bp = GetBasePanel(panelType); if (panelDict.Contains(bp)) { while (true) { bp = panelStack.Pop(); bp.OnBeforeClose(); bp.OnClose(); if (bp.panelInfo.UIPanelType == panelType) { panelDict.Remove(bp); bp.DestoryMyself(); break; } panelDict.Remove(bp); bp.DestoryMyself(); } if (panelStack.Count >= 1) { bp = panelStack.Peek(); bp.OnResume(); } } }