/// <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; } UIPage 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) { UIPage 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(); } } }
public void LoadPage(UIID uid) { if (ui_dict_all.ContainsKey(uid)) { Debug.LogWarning("UI duplicate: " + uid + " already exists."); return; } if (!ui_config_table.ContainsKey(uid)) { Debug.LogError("Load UI fails: " + uid + " is not found in ui config table."); return; } string path = ui_config_table[uid]; //UIPage page = Resources.Load<UIPage>(path); GameObject assetObj = uiBundle.LoadAsset(uid.ToString() + ".prefab") as GameObject; UIPage page_obj = assetObj.GetComponent <UIPage>(); if (page_obj == null) { Debug.LogError("Load UI asset fails: " + uid + " cannot be loaded."); return; } UIPage page = Instantiate(page_obj, this.transform); page.Hide(); ui_dict_all.Add(uid, page); }
internal void GoToMainMenu() { _pauseGuiPage.Hide(); _loadingScreen.Show(1.0f); StartCoroutine(goToMainMenu(1.0f)); }
/// <summary> Close the page event if it not on top </summary> public void RequestForceClosePage(UIPage page) { if (page == null) { Log.Warning(false, this, "ForceLosePage, with null page", this); return; } ValidatePageExistInPagelist(page); if (openPageList.Count == 0) { Log.Warning(false, this, "ForceLosePage, but openStack is empty"); return; } // if the request close page also the top page, then this is the same case with RequestCloseCurrentPageOnly if (page == openPageList.Last.Value) { page.Hide(); openPageList.RemoveLast(); // empty ? then quit if (openPageList.Count == 0) { return; } // call Focus for previous page var previousPage = openPageList.Last.Value; var currentPageHideTime = page.HideDuration; Observable.Timer(TimeSpan.FromSeconds(currentPageHideTime)).Subscribe(_ => previousPage.OnFocus()).AddTo(_destroyDispose); return; } // requestClosePage in the middle of stack, then close it, no OnFocus will be call on any page if (openPageList.Contains(page)) { openPageList.Remove(page); page.Hide(); } else { Log.Warning(false, this, "RequestForceLosePage [{0}], but not contain in OpenPageList", page); return; } // logging const string FORMAT = "RequestForceLosePage : {0}"; LogOpenClosePageProcessToConsole(FORMAT, page.name); }
public void ShowPage(int index) { if (activePage != null) { activePage.Hide(); } if (index >= 0 && index < pages.Length) { activePage = pages[index]; activePage.Show(); } }
public virtual void ReleaseScene() { foreach (PanelId panelId in panels.Keys) { UIPage bPanel = panels[panelId]; bPanel.Hide(true); if (bPanel.mResident) { bPanel.Destroy(); } bPanel.Release(); } panels.Clear(); }
/// <summary> Close the top open page (currentPage) and open the new page (with pageName) </summary> public void RequestCloseCurrentAndOpenNewPage(UIPage page) { if (page == null) { Log.Warning(false, this, "CloseCurrentAndOpenNewPage, with empty pageName", this); return; } ValidatePageExistInPagelist(page); // close current page, popup it out of the openPageList too UIPage topPage = null; if (openPageList.Count > 0) { topPage = openPageList.Last.Value; topPage.Hide(); openPageList.RemoveLast(); } else { Log.Warning(false, this, "OpenPageStack is empty but request CloseCurrentAndOpenNewPage"); } // let the new page on top render, also add it to last in openPageStack page.transform.SetAsLastSibling(); openPageList.AddLast(page); // if currentPage = null, then just simple show new page if (topPage == null) { page.Show(); } // else, wait a little for currentPage to Hide, then show newPage else { Observable.Timer(TimeSpan.FromSeconds(topPage.HideDuration)).Subscribe(_ => page.Show()).AddTo(_destroyDispose); } // logging const string FORMAT = "CloseCurrentAndOpenNewPage : {0}"; LogOpenClosePageProcessToConsole(FORMAT, page.name); }
/// <summary> /// Close target page /// </summary> public static void ClosePage(UIPage target) { //UIInteractive.GetInstance().iPage = null; 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) { UIPage 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(); }