Beispiel #1
0
        private void ClosePanelInfo(PanelInfo panelInfo)
        {
            if (panelInfo == null)
            {
                return;
            }

            //删除对自己的引用
            panelInfo.RemoveMaster(panelInfo.panelID);

            if (panelInfo.nextMaster > 0)
            {
                //重新调整层级就行
            }
            else             //该面板已经没有任何依赖
            {
                UIData data = UIDataTable.Get(panelInfo.uiID);

                bool destroy = true;
                if (data != null && data.cacheCount > 0)
                {
                    if (GetActiveAndCachedUICount(panelInfo.uiID) <= data.cacheCount)
                    {
                        destroy = false;
                    }
                }

                RemovePanelInfo(panelInfo);

                //恢复层级记录
                m_UIRoot.ReleasePanelSortingOrder(panelInfo.sortIndex);

                //处理是否真正销毁面板逻辑
                if (destroy)
                {
                    panelInfo.ClosePanel(destroy);
                }
                else
                {
                    m_CachedPanelList.Add(panelInfo);
                    panelInfo.ClosePanel(destroy);
                }

                //该面板的删除将影响它的依赖面板
                CheckNeedClosePanel(panelInfo.panelID);

                if (destroy)
                {
                    ObjectPool <PanelInfo> .Instance.Recycle(panelInfo);
                }
            }
        }
Beispiel #2
0
        public void DestroyAllPanel(PanelCloseFilter filter = null)
        {
            for (int i = m_ActivePanelInfoList.Count - 1; i >= 0; --i)
            {
                if (i >= m_ActivePanelInfoList.Count)
                {
                    continue;
                }

                PanelInfo panelInfo = m_ActivePanelInfoList[i];

                if (filter != null)
                {
                    if (!filter(panelInfo.panelID))
                    {
                        continue;
                    }
                }

                RemovePanelInfo(panelInfo);

                m_UIRoot.ReleasePanelSortingOrder(panelInfo.sortIndex);

                panelInfo.ClosePanel(true);

                ObjectPool <PanelInfo> .Instance.Recycle(panelInfo);
            }

            for (int i = m_CachedPanelList.Count - 1; i >= 0; --i)
            {
                if (i >= m_CachedPanelList.Count)
                {
                    continue;
                }

                PanelInfo panelInfo = m_CachedPanelList[i];

                m_CachedPanelList.RemoveAt(i);

                GameObject.Destroy(panelInfo.abstractPanel.gameObject);

                ObjectPool <PanelInfo> .Instance.Recycle(panelInfo);
            }
        }