Example #1
0
        /// <summary>
        /// close current page in the "top" node.
        /// </summary>
        public static void ClosePage()
        {
            //Debug.Log("Back&Close PageNodes Count:" + m_currentPageNodes.Count);

            if (m_currentPageNodes == null || m_currentPageNodes.Count <= 1) return;

            TTUIPage closePage = m_currentPageNodes[m_currentPageNodes.Count - 1];
            m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);

            //show older page.
            //TODO:Sub pages.belong to root node.
            if (m_currentPageNodes.Count > 0)
            {
                TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1];
                if (page.isAsyncUI)
                    ShowPage(page.name, page, () =>
                    {
                        closePage.Hide();
                    });
                else
                {
                    ShowPage(page.name, page);

                    //after show to hide().
                    closePage.Hide();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Close target page
        /// </summary>
        public static void ClosePage(TTUIPage target)
        {
            if (target == null) return;
            if (target.isActive() == false)
            {
                if (m_currentPageNodes != null)
                {
                    for (int i = 0; i < m_currentPageNodes.Count; i++)
                    {
                        if (m_currentPageNodes[i] == target)
                        {
                            m_currentPageNodes.RemoveAt(i);
                            break;
                        }
                    }
                    return;
                }
            }

            if (m_currentPageNodes != null && m_currentPageNodes.Count >= 1 && m_currentPageNodes[m_currentPageNodes.Count - 1] == target)
            {
                m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);

                //show older page.
                //TODO:Sub pages.belong to root node.
                if (m_currentPageNodes.Count > 0)
                {
                    TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1];
                    if (page.isAsyncUI)
                        ShowPage(page.name, page, () =>
                        {
                            target.Hide();
                        });
                    else
                    {
                        ShowPage(page.name, page);
                        target.Hide();
                    }

                    return;
                }
            }
            else if (target.CheckIfNeedBack())
            {
                for (int i = 0; i < m_currentPageNodes.Count; i++)
                {
                    if (m_currentPageNodes[i] == target)
                    {
                        m_currentPageNodes.RemoveAt(i);
                        target.Hide();
                        break;
                    }
                }
            }

            target.Hide();
        }
Example #3
0
    /// <summary>
    /// 隐藏当前页面,显示上一层页面
    /// </summary>
    public void HidePage()
    {
        //Debug.Log("Back&Close PageNodes Count:" + m_currentPageNodes.Count);

        if (m_currentPageNodes == null || m_currentPageNodes.Count <= 1)
        {
            return;
        }

        TTUIPage closePage = m_currentPageNodes[m_currentPageNodes.Count - 1];

        m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);
        closePage.Hide();

        //show older page.
        //TODO:Sub pages.belong to root node.
        if (m_currentPageNodes.Count > 0)
        {
            TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1];
            if (page.isAsyncUI)
            {
                ShowPage(page.name, page, null);
            }
            else
            {
                ShowPage(page.name, page);
            }
        }
    }