/// <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> /// Async Show Page with Async loader bind in 'TTUIBind.Bind()' /// </summary> public static void ShowPage(string pageName, TTUIPage pageInstance, Action callback) { ShowPage(pageName, pageInstance, callback, null, true); }
public static void ShowPage(string pageName, TTUIPage pageInstance, Action callback, object pageData) { ShowPage(pageName, pageInstance, callback, pageData, true); }
public static void ShowPage(string pageName, TTUIPage pageInstance, object pageData) { ShowPage(pageName, pageInstance, null, pageData, false); }
public static void ShowPage(string pageName, TTUIPage pageInstance) { ShowPage(pageName, pageInstance, null, null, false); }
private static bool CheckIfNeedBack(TTUIPage page) { return(page != null && page.CheckIfNeedBack()); }
//当被销毁时,ui需要做什么 void OnDestroy() { m_Instance = null; TTUIPage.ClearNodes(); TTUIPage.ClearAllPage(); }
private void Close() { TTUIPage.ClosePage(this); }