public void BackToMainMenu() { if (gameSettings.valueChanged) { string title = "UNSAVED CHANGES"; string message = "There are unsaved changes in the settings. Would you like to apply them first?"; UnityAction yesAction = () => { ApplySettings(); mainMenuHandler.GoToMainMenu(); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }; UnityAction noAction = () => { ResetSettings(); mainMenuHandler.GoToMainMenu(); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }; mainMenuHandler.ShowConfirmDialog(title, message, yesAction, noAction); } else { mainMenuHandler.GoToMainMenu(); } }
public void Quit() { MainMenuHandler.DisableInputReceive(); string title = "QUIT"; string message = "Do you really want to quit?"; if (Network.isServer) { message += " Other players will immediately get disconnected."; } UnityAction yesAction = () => { FindObjectOfType <GameManager>().LoadLevel("Main Menu", 0); Network.Disconnect(200); }; UnityAction noAction = () => { Destroy(confirmDialogInstance); confirmDialogInstance = null; MainMenuHandler.EnableInputReceive(); }; confirmDialogInstance = Instantiate(confirmDialogPrefab); ConfirmBox confirmDialogInfo = confirmDialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); }
void OnDisconnectedFromServer(NetworkDisconnection info) { foreach (NetworkView networkView in FindObjectsOfType <NetworkView>()) { if (networkView.stateSynchronization != NetworkStateSynchronization.Off) { Destroy(networkView.gameObject); } } if (Network.isClient) { if (info == NetworkDisconnection.Disconnected) { MainMenuHandler.DisableAllCanvases(); string title = "SERVER CLOSED"; string message = "The host left the game."; UnityAction okAction = () => { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); mainMenuHandler.GoToMainMenu(); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); } } }
public void PlayerNameOK() { if (mainMenuHandler.dialogInstance.GetComponent <TextInputBox>().inputField.text != "") { ApplyPlayerName(mainMenuHandler.dialogInstance.GetComponent <TextInputBox>().inputField.text); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); } }
void OnConnectedToServer() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); enabled = false; GetComponent <LobbyManager>().enabled = true; GetComponent <MenuLobby>().enabled = true; Network.Instantiate(mainMenuHandler.playerInfoPrefab, Vector3.zero, Quaternion.identity, 0); }
private void ErrorTeamNotSelected() { string title = "ERROR"; string message = "Not all players are in a team. Wait for them to choose a team."; UnityAction okAction = () => { MainMenuHandler.EnableInputReceive(); Destroy(mainMenuHandler.dialogInstance); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); }
public void BackToPauseMenu() { if (gameSettings.valueChanged) { string title = "UNSAVED CHANGES"; string message = "There are unsaved changes in the settings. Would you like to apply them first?"; UnityAction yesAction = () => { ApplySettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; UnityAction noAction = () => { ResetSettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; MainMenuHandler.DisableInputReceive(); dialogInstance = Instantiate(confirmDialogBox); ConfirmBox confirmDialogInfo = dialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); } else { FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; } }
private void ErrorTooManyOfSameKart(GameModeTeams teams) { string title = "ERROR"; string message = ""; switch (teams) { case GameModeTeams.None: message = "Two other players have already selected this kart. Choose something else."; break; case GameModeTeams.Two: message = "Your teammate has already selected this kart. Choose something else."; break; } UnityAction okAction = () => { MainMenuHandler.EnableInputReceive(); Destroy(mainMenuHandler.dialogInstance); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); }
public void PlayerNameCancel() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
public void ExitDecline() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
public void ConnectionFailedConfirm() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
public void GameModeNotSelectedOK() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }