Exemplo n.º 1
0
        public static void hideTopPanel(CLPanelBase panel, bool showMain, bool immed)
        {
            if (panel == null || (panelRetainLayer.Count > 0 && panelRetainLayer.Peek() == panel))
            {
                if (showMain && !string.IsNullOrEmpty(self.mainPanelName) &&
                    topPanel != null && string.Compare(self.mainPanelName, topPanel.name) == 0)
                {
                    topPanel.refresh();
                    return;
                }
                if (panelRetainLayer.Count > 0)
                {
                    self.depth -= depthOffset;
                    self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                    seaHidePanel.Enqueue(panelRetainLayer.Pop());
                    isHidePanel = true;
                }
                if (panelRetainLayer.Count > 0)
                {
                    isShowTopPanel = true;
                }
                else
                {
                    if (CLPBackplate.self != null)
                    {
                        CLPBackplate.self.proc(null);
                    }
                }
                oldPanel    = oldoldPanel;
                oldoldPanel = null;
            }
            else
            {
                rmPanelRetainLayer(panel);
                seaHidePanel.Enqueue(panel);
                isHidePanel = true;
            }

            if (immed)
            {
                self.Update();
            }
        }
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);
                }
            }
        }