Exemplo n.º 1
0
        /// <summary>
        /// 关闭面板
        /// </summary>
        public void ClosePanel(string uiname)
        {
            BasePanel panel = GetPanel(uiname);

            if (m_OnDisplayPanelDic.ContainsKey(panel.Level) && m_OnDisplayPanelDic[panel.Level].Contains(panel))
            {
                panel.OnClose();
                m_OnDisplayPanelDic[panel.Level].Remove(panel);
            }

            int index = panel.Level + 1;
            List <BasePanel> temp;

            while (m_OnDisplayPanelDic.ContainsKey(index))
            {
                temp = m_OnDisplayPanelDic[index];
                if (temp.Count > 0)
                {
                    temp.End().OnClose();
                    temp.RemoveAt(temp.Count - 1);
                }
                else
                {
                    break;
                }
            }
            if (m_OnDisplayPanelDic.ContainsKey(panel.Level - 1))
            {
                m_OnDisplayPanelDic[panel.Level - 1].End().OnResume();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 出栈 ,把页面从界面上移除
        /// </summary>
        public BasePanel PopPanel()
        {
            if (m_PanelStack == null)
            {
                m_PanelStack = new Stack <BasePanel>();
            }

            if (m_PanelStack.Count <= 0)
            {
                return(null);
            }

            BasePanel topPanel = m_PanelStack.Pop(); // 获取并移除栈顶面板

            topPanel.OnClose();                      // 关闭面板
            return(topPanel);
        }