/// <summary> /// This method interrupt all threads when the joystick is press /// </summary> /// <param name="pbData1"></param> /// <param name="pbData2"></param> /// <param name="pbTime"></param> private void _joystickButton_OnInterrupt(uint pbData1, uint pbData2, DateTime pbTime) { // We do this only if we are on the main menu if (_menuState == MENU_STATE.initial) { switch (_menu) { case 0: _menuState = MENU_STATE.initial; break; case 1: _menuState = MENU_STATE.addCard; break; case 2: _menuState = MENU_STATE.deleteCard; break; case 3: _menuState = MENU_STATE.displayCards; break; case 4: _menuState = MENU_STATE.secretCode; break; default: _menuState = MENU_STATE.initial; break; } DeleteCurrentBadgescan(); LCD.GetInstance().Clear(); } }
/// <summary> /// Show credits panel /// </summary> public void ShowCredits() { m_state = MENU_STATE.CREDITS; m_optionsGroup.SetActive(false); m_creditsGroup.SetActive(true); m_mainGroup.SetActive(false); }
public void ChangeMenuState(int newStateID) { PlayerPrefs.SetString("Control Type", controlTypeChoice.text); // in case change to options or stats while loading mainMenuPanel.color = new Color(mainMenuPanel.color.r, mainMenuPanel.color.g, mainMenuPanel.color.b, 0.4f); mainMenuLogo.color = new Color(mainMenuLogo.color.r, mainMenuLogo.color.g, mainMenuLogo.color.b, 1f); playButtonText.color = new Color(playButtonText.color.r, playButtonText.color.g, playButtonText.color.b, 1f); statsButtonText.color = new Color(statsButtonText.color.r, statsButtonText.color.g, statsButtonText.color.b, 1f); optionsButtonText.color = new Color(optionsButtonText.color.r, optionsButtonText.color.g, optionsButtonText.color.b, 1f); quitButtonText.color = new Color(quitButtonText.color.r, quitButtonText.color.g, quitButtonText.color.b, 1f); versionText.color = new Color(versionText.color.r, versionText.color.g, versionText.color.b, 1f); splashLogo.SetActive(false); mainMenuContainer.SetActive(false); statMenuContainer.SetActive(false); optionsMenuContainer.SetActive(false); endOfGameContainer.SetActive(false); MENU_STATE newState = (MENU_STATE)newStateID; switch (newState) { case MENU_STATE.SPLASH: splashLogo.SetActive(true); break; case MENU_STATE.MAIN: mainMenuContainer.SetActive(true); break; case MENU_STATE.STATS: highscoreStatsText.SetText("Highscore: " + PlayerPrefs.GetInt("Highscore", 0).ToString()); blocksBrokenStatsText.SetText("Most Blocks Broken in a Run: " + PlayerPrefs.GetInt("Most Blocks Broken in a Run", 0).ToString()); statMenuContainer.SetActive(true); break; case MENU_STATE.OPTIONS: optionsMenuContainer.SetActive(true); break; case MENU_STATE.END_OF_GAME: scoreText.SetText("Score: " + PlayerPrefs.GetInt("Last Game Score", 0).ToString()); highscoreText.SetText("Highscore: " + PlayerPrefs.GetInt("Highscore", 0).ToString()); if (PlayerPrefs.GetInt("Last Game Score", 0) >= PlayerPrefs.GetInt("Highscore", 0)) { endMessage.SetText("New highscore!"); } else { endMessage.SetText("Try again!"); } endOfGameContainer.SetActive(true); break; default: break; } currentState = newState; }
/// <summary> /// Show main panel /// </summary> public void ShowMain() { m_state = MENU_STATE.MAIN; m_optionsGroup.SetActive(false); m_creditsGroup.SetActive(false); m_mainGroup.SetActive(true); }
private IEnumerator ShowInstructionsCoroutine() { state = MENU_STATE.LEADERBOARD; disableMainMenu(); instruction1.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction1.SetActive(false); instruction2.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction2.SetActive(false); instruction3.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction3.SetActive(false); instruction4.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction4.SetActive(false); instruction5.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction5.SetActive(false); instruction6.SetActive(true); yield return(new WaitForSeconds(showDuration)); instruction6.SetActive(false); state = MENU_STATE.MAINMENU; enableMainMenu(); leader1.SetActive(false); }
/// <summary> /// Show options panel /// </summary> public void ShowOptions() { m_state = MENU_STATE.OPTIONS; m_optionsGroup.SetActive(true); m_creditsGroup.SetActive(false); m_mainGroup.SetActive(false); }
/// <summary> /// Init animation (Ho-OH and Title appears) /// </summary> void InitMenu() { m_state = MENU_STATE.INIT; PMR_AudioManager.Instance.PlayMenuBGM(); PMR_EventManager.TriggerEvent(PMR_EventSetup.Game.GO_TO_MENU); m_mainAnimator.SetTrigger("init"); }
private IEnumerator ShowLeaderboardCoroutine() { state = MENU_STATE.LEADERBOARD; disableMainMenu(); leader1.SetActive(true); string textToSet; if (isFirebase) { textToSet = " Leaderboard\n\n"; for (int i = 1; i <= 10; i++) { textToSet += i + ": " + leaderboardData [i - 1].name + " | " + leaderboardData [i - 1].score + "\n"; } } else { textToSet = notFirebaseLeaderboardText; } leader1.GetComponent <TextMesh> ().text = textToSet; yield return(new WaitForSeconds(showDuration)); state = MENU_STATE.MAINMENU; enableMainMenu(); leader1.SetActive(false); }
public void QuitGame() { //Set state to quit just incase state = MENU_STATE.QUIT; Debug.Log("Quitting..."); //Debug message to show that it works in editor Application.Quit(); }
/// <summary> /// On Start we start all listeners /// </summary> // Use this for initialization void Start() { m_eventSystem = EventSystem.current; m_state = MENU_STATE.INIT; TranslateTexts(); StartAllListeners(); }
private void HandleLogoSelected(string controlName) { if (m_currState == MENU_STATE.JUST_LOGO) { m_currState = MENU_STATE.SHOWING_CONTROLS; StartCoroutine(AnimateInARControls()); } }
public void CharacterSelectComplete() { //Make sure both players have made a selection before allowing them to proceed if (p1Selected != -1 && p2Selected != -1) { SceneManager.LoadScene(gameScene); state = MENU_STATE.GAME; } }
public void Init(MENU_TYPE menuType) { Debug.Log("Initializing logo"); // build the prefabs BuildAndSetupMainLogo(menuType); // set current state to open m_currState = MENU_STATE.JUST_LOGO; }
private IEnumerator ShowCreditsCoroutine() { state = MENU_STATE.CREDITS; disableMainMenu(); credit1.SetActive(true); yield return(new WaitForSeconds(showDuration)); state = MENU_STATE.MAINMENU; enableMainMenu(); credit1.SetActive(false); }
protected override void UpdateWorld() { oKeyState = Keyboard.GetState(); //XNACS1Base.SetBottomEchoColor(Color.Red); //XNACS1Base.EchoToBottomStatus("HUD:" + oHexes[0,0].o); oCamera.Update(oCursor); oCursor.Update(oCamera); #region Exit Game (F1) if (oKeyState.IsKeyDown(Keys.F1)) { this.Exit(); } #endregion #region Update Current Menu if (oMenuState == MENU_STATE.START) { if (oStartMenu == null) { oStartMenu = new StartMenu(); } else { oMenuState = oStartMenu.Update(oCursor, oCamera); if (oMenuState != MENU_STATE.START) { oStartMenu = null; } } } else if (oMenuState == MENU_STATE.BASIC_GAME) { if (oBasicGame == null) { oBasicGame = new BasicGame(oCamera); } else { oMenuState = oBasicGame.Update(oCursor, oCamera); if (oMenuState != MENU_STATE.BASIC_GAME) { oBasicGame = null; } } } #endregion }
private void EventPlayHoverSelected() { Debug.Log("Selected Play Menu"); if (state == MENU_STATE.MAINMENU) { // Start Round from round manager // disable main menu disableMainMenu(); state = MENU_STATE.DISABLED; roundManager.startRound(1); } }
//-------------------------------------------------------------------------------------------- // DRAW_MENU_FUNCTIONS //-------------------------------------------------------------------------------------------- /* * Dibuja los botones del menu principal en la tool del editor (los botones los coje del array "buttons" */ private void draw_tool_buttons() { GUILayout.Label("Tools", EditorStyles.boldLabel); menu_state = (MENU_STATE)GUILayout.SelectionGrid((int)menu_state, buttons, 2); /* * switch (menu_state) * { * case MENU_STATE.DATABASE: getAllSceneObjects(); * break; * }*/ //Graphics.DrawMeshNow(a_mesh, Vector3.zero, Quaternion.identity); }
void handlePause() { if (gameState == GAME_STATE.RUNNING) { gameState = GAME_STATE.PAUSED; pauseCanvas.SetActive(true); changeOption(); Time.timeScale = 0f; } else if (gameState == GAME_STATE.PAUSED) { gameState = GAME_STATE.RUNNING; currentState = MENU_STATE.EXIT; Time.timeScale = 1f; pauseCanvas.SetActive(false); } }
//Change the option of the menu void changeOption() { switch (currentState) { default: case MENU_STATE.START: currentState = MENU_STATE.EXIT; startButton.GetComponent <Option>().setOption(false); exitButton.GetComponent <Option>().setOption(true); break; case MENU_STATE.EXIT: currentState = MENU_STATE.START; startButton.GetComponent <Option>().setOption(true); exitButton.GetComponent <Option>().setOption(false); break; } }
/// <summary> /// This method restore to initial state (main menu) /// </summary> private void RestoreInitialState() { _menu = 0; _menuState = MENU_STATE.initial; _servoState = SERVO_STATE.close; _secretState = SECRET_CODE.up1; _scanCardState = SCAN_CARD_STATE.waitRFID; _addCardState = ADD_CARD_STATE.waitRFID; _displayCardsState = DISPLAY_CARDS_STATE.listIsEmpty; _deleteCardState = DELETE_CARD_STATE.listIsEmpty; // Refresh the LCD text fields LCDTextFields.Content = Card.DEFAULT_NAME; LCDTextFields.CursorPosition = 0; LCDTextFields.ShouldBeRefresh = true; DeleteCurrentBadgescan(); LCD.GetInstance().Clear(); DisplayMainMenu(_menu); }
/// <summary> /// Just event system and change difficulty stuff /// </summary> private void Update() { if (m_state == MENU_STATE.PRESS_START) { if (PMR_InputManager.PressedSkipButton()) { m_state = MENU_STATE.MAIN; m_eventSystem.SetSelectedGameObject(m_newGameText.transform.parent.gameObject); ShowMainAnimation(); } } else if (m_state == MENU_STATE.MAIN) { if (m_eventSystem.currentSelectedGameObject == null && (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.UpArrow))) { m_eventSystem.SetSelectedGameObject(m_newGameText.transform.parent.gameObject); } if (Input.GetKeyDown(KeyCode.Keypad1) && PMR_GameManager.Instance.Difficulty != DIFICULTY.EASY) { PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.EASY); m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString()); } if (Input.GetKeyDown(KeyCode.Keypad2) && PMR_GameManager.Instance.Difficulty != DIFICULTY.MID) { PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.MID); m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString()); } if (Input.GetKeyDown(KeyCode.Keypad3) && PMR_GameManager.Instance.Difficulty != DIFICULTY.DIFFICULT) { PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.DIFFICULT); m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString()); } } }
/// <summary> /// Start menu is shown (Has an animation in loop) /// </summary> public void StartMenu() { m_state = MENU_STATE.PRESS_START; m_pressStartGO.SetActive(true); }
public void GotoCharacterSelection() { state = MENU_STATE.CHARACTER_SELECT; //selectionScreen.SetActive(true); }