Exemplo n.º 1
0
        /// <summary>
        /// 移除 UIPanelType 里面的
        /// </summary>
        /// <param name="panel"></param>
        public void Remove(BasePanel panel)
        {
            // 创建一个临时的栈
            var tempStack = new Stack <BasePanel>();

            //Debug.Log($"销毁了 {panel}");
            while (panelStack.Count != 0)
            {
                var pop = panelStack.Pop();
                if (pop != panel)
                {
                    tempStack.Push(pop);
                }
            }
            // 填回去
            while (tempStack.Count != 0)
            {
                panelStack.Push(tempStack.Pop());
            }

            panelDict.Remove(panel.uiType);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 设置默认的栈顶元素
 /// </summary>
 /// <param name="panelType">界面类型</param>
 /// <param name="basePanel">组件</param>
 public void SetDefaultPopPanel(UIPanelType panelType, BasePanel basePanel)
 {
     panelDict.Add(panelType, basePanel);
     panelStack.Push(basePanel);
 }