/// <summary> /// 关闭最前的页面 /// </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(); } } }
/// <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(); }
/// <summary> /// 关闭目标界面,并且刷新当前界面的上一级界面 refresh active /// </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; } } //如果target在顶部,则移除它 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. //如果不是只剩target,则把最上层的ui刷新一遍 if (m_currentPageNodes.Count > 0) { if (target.mode == UIMode.NeedBack) { TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1]; page.Refresh(); } //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; } } } if (target.isActive()) { target.Hide(); } }
/// <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) { if (closePage.mode == UIMode.NeedBack) { TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1]; page.Refresh(); } } closePage.Hide(); }