/// <summary> /// Changes the currently selected menu item /// </summary> /// <param name="vert"></param> public void TraverseMenu(float vert) { // Find out the previously selected button. int selected = (int)selectedID; // Change style of previously selected button to regular. changeButtonToUnselected(MenuButtons[selected]); // Based on input vert, change the current selected button ID. if (vert > 0) { selected++; } else if (vert < 0) { selected--; } if (selected < 0) { selected = TOTAL_MENU_ITEMS - 1; } else if (selected == TOTAL_MENU_ITEMS) { selected = 0; } selectedID = (MenuItemID)selected; // Change style of newly selected button to selected. changeButtonToSelected(MenuButtons[selected]); // Set the tag text based on the selected button. changeTag(); }
public void HandleLaunchEvent(MenuItemID menuItemID) { switch(menuItemID) { case MenuItemID.NEW_GAME_SCREEN_TUTORIAL: //Launch tutorial scene Debug.Log("Launching tutorial..."); break; case MenuItemID.NEW_GAME_SCREEN_STORY_MODE: //Start story Debug.Log("Launching story..."); break; case MenuItemID.NEW_GAME_SCREEN_SURVIVAL: //Start survival Debug.Log("Launching survival..."); break; case MenuItemID.LOAD_GAME_SCREEN_LOAD: //Load selected game Debug.Log("Launching load..."); break; case MenuItemID.OPENING_SCREEN_QUICK_MATCH: //Start a random match Debug.Log("Launching quick match..."); break; case MenuItemID.QUIT_SCREEN_QUIT: //Quit Application Application.Quit(); break; } }
// Start is called before the first frame update void Start() { // Set current state to Game Over. InputManager.instance.currentState = InputManager.InputState.GAME_OVER; // Set selected button ID to the resume button. selectedID = MenuItemID.ResumeButton; // Trigger selection of first menu item. TraverseMenu(0); }
// This function is called when the pause menu is opened in the game. public void OpenPauseMenu() { // Show this panel. PauseMenuPanel.gameObject.SetActive(true); this.PauseMenuPanelIsActive = true; // Set selected button ID to the resume button. selectedID = MenuItemID.ResumeButton; // Trigger selection of first menu item. TraverseMenu(0); }
// Start is called before the first frame update void Start() { // Set selected button ID to the resume button. selectedID = MenuItemID.ResumeButton; // Trigger selection of first menu item. TraverseMenu(0); // Hide this panel. PauseMenuPanel.gameObject.SetActive(false); this.PauseMenuPanelIsActive = false; }
public void OnShowMenu(CtxObject obj) { if (menuItems == null) { int cnt = (int)MenuItemID.Count; menuItems = new CtxMenu.Item[cnt]; for (int i = 0; i < cnt; i++) { MenuItemID itemID = (MenuItemID)i; menuItems[i] = new CtxMenu.Item(); menuItems[i].text = ItemText(itemID); if (menuItems[i].text.StartsWith("Separator")) { menuItems[i].isSeparator = true; } else { menuItems[i].id = i; } } menuItems[(int)MenuItemID.Small].isCheckable = true; menuItems[(int)MenuItemID.Medium].isCheckable = true; menuItems[(int)MenuItemID.Large].isCheckable = true; menuItems[(int)MenuItemID.Small].mutexGroup = 0; menuItems[(int)MenuItemID.Medium].mutexGroup = 0; menuItems[(int)MenuItemID.Large].mutexGroup = 0; menuItems[(int)MenuItemID.Stealth].isCheckable = true; menuItems[(int)MenuItemID.Shield].isCheckable = true; } if (transform.localScale.x == 1f) { CtxHelper.SetChecked(menuItems, (int)MenuItemID.Small, true); } else if (transform.localScale.x == 2f) { CtxHelper.SetChecked(menuItems, (int)MenuItemID.Medium, true); } else { CtxHelper.SetChecked(menuItems, (int)MenuItemID.Large, true); } menuItems[(int)MenuItemID.Stealth].isChecked = stealthOn; menuItems[(int)MenuItemID.Shield].isChecked = shieldOn; obj.menuItems = menuItems; }
public void InteractionPointerEnterButton(Button thisButton) { // Find out the previously selected button. int selected = (int)selectedID; // Change style of previously selected button to regular. changeButtonToUnselected(MenuButtons[selected]); // Change current selected ID to the button that was just hovered. selectedID = (MenuItemID)System.Enum.Parse(typeof(MenuItemID), thisButton.name); selected = (int)selectedID; // Change style of newly selected button to selected. changeButtonToSelected(MenuButtons[selected]); }
string ItemText(MenuItemID itemID) { string upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string text = itemID.ToString(); string result = ""; int start = 0, i, cnt = text.Length; for (i = 1; i < cnt; i++) { if (upperCase.IndexOf(text[i]) >= 0) { result += text.Substring(start, i - start) + " "; start = i; } } if (i > start) { result += text.Substring(start, i - start); } return(result); }
public void HandleSliderEvent(MenuItemID menuItemID, float step) { }
public void HandleLabelButtonEvent(MenuItemID menuItemID) { Debug.Log("Event Handler: Handling event " + menuItemID); SetScreenActive(_transitions[menuItemID]); }
public UserPagesMenuItem(MenuItemID _id, string _title) { Id = _id; Title = _title; }
// Start is called before the first frame update void Start() { // Set selected button ID to the resume button. selectedID = MenuItemID.ResumeButton; }