Exemplo n.º 1
0
        public static void destroyPanel(CLPanelBase p, bool needCallHideFunc)
        {
            if (p == null || p.name == CLMainBase.self.firstPanel)
            {
                return;
            }
            string pName = p.name;

            panelBuff.Remove(pName);
            panelAssetBundle.Remove(pName);
            if (needCallHideFunc)
            {
                p.hide();
            }
            GameObject.DestroyImmediate(p.gameObject, true);
            p = null;
        }
Exemplo n.º 2
0
        public void Update()
        {
            if (isShowPanel)
            {
                isShowPanel = false;
                CLPanelBase p = seaShowPanel.Dequeue();
                if (p != null)
                {
                    p.show();
                    p.panel.renderQueue = UIPanel.RenderQueue.StartAt;
                    // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
                    p.panel.startingRenderQueue = Const_RenderQueue + p.panel.depth;
                }
                if (seaShowPanel.Count > 0)
                {
                    isShowPanel = true;
                }
            }

            if (isHidePanel)
            {
                isHidePanel = false;
                CLPanelBase p = seaHidePanel.Dequeue();
                if (p != null)
                {
                    p.hide();
                }
                if (seaHidePanel.Count > 0)
                {
                    isHidePanel = true;
                }
                else
                {
                    CLPBackplateProc(null);
                }
            }

            if (isShowTopPanel)
            {
                isShowTopPanel = false;

                if (oldPanel != null)
                {
                    if (!isShowPrePanel)
                    {
                        oldPanel.hide();
                        if (oldoldPanel != null)
                        {
                            //							Vector3 newPos = oldoldPanel.transform.localPosition;
                            //							oldoldPanel.transform.localPosition = newPos;
                            oldPanel    = oldoldPanel;
                            oldoldPanel = null;
                        }
                    }
                    else
                    {
                        //						Vector3 newPos = oldPanel.transform.localPosition;
                        //						oldPanel.transform.localPosition = newPos;
                        //						if (oldoldPanel != null) {
                        //							newPos = oldoldPanel.transform.localPosition;
                        //							oldoldPanel.transform.localPosition = newPos;
                        //						}
                    }
                }
                //置顶的处理放在后面,防止oldoldPannel = curPannel的情况
                if (panelRetainLayer.Count > 0)
                {
                    //GlobalMemoryVar.curStatus.changeTo (GlobalMemoryVar.sNgui);
                    float panelZ = 0;
                    if (topPanel != null)
                    {
                        panelZ = topPanel.transform.localPosition.z;
                    }
                    topPanel = panelRetainLayer.Peek();
                    if (topPanel != null)
                    {
                        if (!topPanel.isActive)
                        {
                            depth         += depthOffset;
                            topPanel.depth = depth;
                            topPanel.show();
                        }
                        else
                        {
                            topPanel.depth = depth;
                            topPanel.refresh();
                        }
                        topPanel.panel.renderQueue = UIPanel.RenderQueue.StartAt;
                        // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
                        topPanel.panel.startingRenderQueue = Const_RenderQueue + depth;

                        Vector3 newPos = topPanel.transform.localPosition;
                        newPos.z = -topPanel.depth;
                        topPanel.transform.localPosition = newPos;
                    }

                    CLPBackplateProc(topPanel);
                    onTopPanelChange(topPanel);
                }
                else
                {
                    CLPBackplateProc(null);
                }
            }
        }