protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); if (_onForceClosing) { return; } var result = MessageBox.Show( "Shutdown server?", "Shutdown", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation ); if (result == DialogResult.Yes) { UnityApplication.Quit(); } else { e.Cancel = true; } }
private void InputHandler() { if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }
public void ConfirmQuit() { var dialogResult = MessageBox.Show("really want exit game ?", "system message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult == DialogResult.OK) { Application.CancelQuit(); //TODO write you logic method Application.Quit(); } }
override protected void onSelect() { switch (this.getCurrentOpt()) { case 0: this.LoadLevel(1); break; case 1: this.LoadScene("scenes/000-game-controller/LevelSelect"); break; case 2: this.LoadScene("scenes/000-game-controller/Options"); break; case 3: App.Quit(); break; } }
public void ExitGame() { Application.Quit(); }
public void MenuExit() { MenuExitText.text = "Exit Pressed"; Application.Quit(); }
public void QuitButton_OnClick() { // todo: Prompt do you want to save? Application.Quit(); }
// Update is called once per frame void Update() { // Determines what scene it is, and if the appropiate input is made, moves to the next Scene Scene m_scene = SceneManager.GetActiveScene(); // Checks for the WinCondition to be fufilled in the PlayerController Script if (m_scene.name == "MainMenu") { //if (Input.GetKeyDown(KeyCode.Space) && p.WinState) if (Input.GetKeyDown(KeyCode.Space)) { SceneManager.LoadScene(1); } } // This code checks the game every frame to during the Game scene to see if the lose condition has been activated. // If it has, it store the name and sprite of the winning / losing player and change to the game over screen else if (m_scene.name == "Game" && player2.getScore() == 5) { winningPlayerName = "Player 1"; losingPlayerName = "Player 2"; winningPlayer = player2.up; losingPlayer = player1.up; SceneManager.LoadScene(2); } else if (m_scene.name == "Game" && player1.getScore() == 5) { winningPlayerName = "Player 2"; losingPlayerName = "Player 1"; winningPlayer = player1.up; losingPlayer = player2.up; SceneManager.LoadScene(2); } // This code stores a few situational conditions in the game over screen, altering the images depending on who won. else if (m_scene.name == "GameOver") { // This code sets the images properly for the game over screen winningPlayerHead.sprite = winningPlayer; winningPlayerHead2.sprite = winningPlayer; losingPlayerHead.sprite = losingPlayer; // This code sets the text and color of the game over screen middle playerVictory.text = winningPlayerName; playerLoss.text = losingPlayerName; if (winningPlayerName == "Player 1") { playerVictory.color = Color.green; playerLoss.color = Color.magenta; } else { playerVictory.color = Color.magenta; playerLoss.color = Color.green; } // Finally, this last piece of coat allows us to return to the main menu if (Input.GetKeyDown(KeyCode.Space)) { SceneManager.LoadScene(0); } } // This gives the game a "quit" button by pressing Escape. If it is pressed outside of main menu, it returns you to main menu if (Input.GetKey("escape")) { if (m_scene.name == "MainMenu") { Application.Quit(); } else { SceneManager.LoadScene(0); } } }
public void Button_Close() { Application.Quit(); }