public void GoToPage(MenuPage newPage) { if (newPage == null && isMainMenu && GameManager.isInMainMenuScene) { return; } if (currentPage != null) { currentPage.UninitializeUI(); // UIManager.HideUI(currentPage.uiObject); } currentPage = newPage; if (newPage == null) { // if (!GameManager.isInMainMenuScene || !isMainMenu) { // Debug.LogError("CLOSE"); CloseMenu(); // } return; } currentPage.manualMenu = this; currentPage.InitializeUI(actorContexts); // UIManager.ShowUI(currentPage.uiObject); // currentPage.uiObject.SubscribeToActionEvent(currentPage.OnUIInput); // currentPage.uiObject.SubscribeToSelectEvent(currentPage.OnUISelect); // currentPage.uiObject.actionHandler = currentPage.GetUIActions; // currentPage.uiObject.AddActionHints() // // add controller hints for that menu page.... // UIManager.AddDefaultControllerHintsToUI (currentPage.uiObject); // update buttons // buttonReferences = null; // UISelectableHolder asSelectable = newPage.uiObject as UISelectableHolder; // if (asSelectable != null) { // asSelectable.SetMainText(newPage.PageTitle()); // // (uiObject as UIPage).SetTitle(newPage.pageTitle); // List<ManualMenuButton> allButtons = currentPage.GetAllButtons(); // int c = allButtons.Count;// currentPage.menuButtons.Length; // buttonReferences = asSelectable.GetAllSelectableElements(c); // UIManager.SetSelectionDelayed(buttonReferences[0].gameObject); // for (int i = 0 ; i < c; i++) { // buttonReferences[i].uiText.SetText(allButtons[i].displayName); // buttonReferences[i].customData = new object[] { allButtons[i] }; // } // } }