Пример #1
0
        /// <summary>
        /// 关闭目标界面
        /// </summary>
        public static void ClosePage(WTUIPage 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);

                if (m_currentPageNodes.Count > 0)
                {
                    WTUIPage 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();
        }
Пример #2
0
        /// <summary>
        /// 关闭顶层界面
        /// </summary>
        public static void ClosePage()
        {
            //Debug.Log("Back&Close PageNodes Count:" + m_currentPageNodes.Count);
            //修改
            if (m_currentPageNodes == null || m_currentPageNodes.Count <= 0)
            {
                return;
            }

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

            m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);//从list中移除目前最后一个界面


            if (m_currentPageNodes.Count > 0)                                     //还有其他界面
            {
                WTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1]; //移除过后最后一个界面
                if (page.isAsyncUI)
                {
                    ShowPage(page.name, page, () =>
                    {
                        closePage.Hide();
                    });
                }
                else
                {
                    ShowPage(page.name, page);


                    closePage.Hide();
                }
            }
        }