Beispiel #1
0
    private IEnumerator ShowPanelCoroutine(string panelName)
    {
        if (tmpPanel != null)
        {
            NGUITools.SetActive(tmpPanel.gameObject, false);
            tmpPanel = null;
        }
        //等待panel创建.
        yield return(StartCoroutine(CreatePanel(panelName)));

        BasePanel panel = GetPanel(panelName);

        if (panel != currentPanel)
        {
            BasePanel tempPanel = null;
            BasePanel perPanel  = null;
            if (panelHistory.Count > 0)
            {
                tempPanel = panelHistory.Peek();
            }
            if (currentPanel != null)
            {
                if (panel.GetPanelType() == BasePanel.PanelType.Normal)
                {
                    HidePanel(currentPanel);
                    StartCoroutine(currentPanel.PlayLeftLeaveAnimation());
                    if (currentPanel.GetPanelType() == BasePanel.PanelType.Cover)
                    {
                        HidePanel(currentPanel);
                        StartCoroutine(currentPanel.PlayLeftLeaveAnimation());
                        BasePanel tPanel = panelHistory.Peek();
                        if (tPanel != null)
                        {
                            HidePanel(tPanel);
                            StartCoroutine(tPanel.PlayLeftLeaveAnimation());
                        }
                    }
                }
                if (tempPanel != panel)
                {
                    panelHistory.Push(currentPanel);
                }
                perPanel = currentPanel;
            }


            currentPanel = panel;
            //			currentPanelName = panelName;
            NGUITools.SetActive(currentPanel.gameObject, true);
            StartCoroutine(currentPanel.PlayLeftAppearAnimation());
        }
        currentPanel.Refresh();
    }