/// <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; LPUIPage 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) { LPUIPage 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(LPUIPage 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) { LPUIPage 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(); }
private static void HideOldNodes() { if (m_currentPageNodes.Count < 0) return; LPUIPage topPage = m_currentPageNodes[m_currentPageNodes.Count - 1]; if (topPage.mode == UIMode.HideOther) { //form bottm to top. for (int i = m_currentPageNodes.Count - 2; i >= 0; i--) { if(m_currentPageNodes[i].isActive()) m_currentPageNodes[i].Hide(); } } }
/// <summary> /// make the target node to the top. /// </summary> private static void PopNode(LPUIPage page) { if (m_currentPageNodes == null) { m_currentPageNodes = new List<LPUIPage>(); } if (page == null) { Debug.LogError("[UI] page popup is null."); return; } //sub pages should not need back. if (CheckIfNeedBack(page) == false) { return; } bool _isFound = false; for (int i = 0; i < m_currentPageNodes.Count; i++) { if (m_currentPageNodes[i].Equals(page)) { m_currentPageNodes.RemoveAt(i); m_currentPageNodes.Add(page); _isFound = true; break; } } //if dont found in old nodes //should add in nodelist. if (!_isFound) { m_currentPageNodes.Add(page); } //after pop should hide the old node if need. HideOldNodes(); }
private static void ShowPage(string pageName, LPUIPage pageInstance, Action callback, object pageData, bool isAsync) { if (string.IsNullOrEmpty(pageName) || pageInstance == null) { Debug.LogError("[UI] show page error with :" + pageName + " maybe null instance."); return; } if (m_allPages == null) { m_allPages = new Dictionary<string, LPUIPage>(); } LPUIPage page = null; if (m_allPages.ContainsKey(pageName)) { page = m_allPages[pageName]; } else { m_allPages.Add(pageName, pageInstance); page = pageInstance; } //if active before,wont active again. //if (page.isActive() == false) { //before show should set this data if need. maybe.!! page.m_data = pageData; if (isAsync) page.Show(callback); else page.Show(); } }
public static void ShowPage(string pageName, LPUIPage pageInstance, Action callback, object pageData) { ShowPage(pageName, pageInstance, callback, pageData, true); }
/// <summary> /// Async Show Page with Async loader bind in 'TTUIBind.Bind()' /// </summary> public static void ShowPage(string pageName, LPUIPage pageInstance, Action callback) { ShowPage(pageName, pageInstance, callback, null, true); }
public static void ShowPage(string pageName, LPUIPage pageInstance, object pageData) { ShowPage(pageName, pageInstance, null, pageData, false); }
public static void ShowPage(string pageName, LPUIPage pageInstance) { ShowPage(pageName, pageInstance, null, null, false); }
private static bool CheckIfNeedBack(LPUIPage page) { return page != null && page.CheckIfNeedBack(); }