public void BtnYes() { if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 1) { if (NetworkManager.IsConnected()) { NetworkManager.DebugLog("Cannot restart!\n"); } else { SceneManager.LoadScene("GameScene"); } } else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 2) { if (NetworkManager.IsConnected()) { NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic(); networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.QUIT); } else { SceneManager.LoadScene("MainMenu"); } } }
public void BtnYes() { if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 1) { if (NetworkManager.IsConnected()) { NetworkManager.DebugLog("Cannot restart!\n"); } else { GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd(); if (AudioManager.Instance) { AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK); } BGManager.Instance.partsParent.SetActive(false); BackToMainMenu(2, false); Adverts.Instance.RandomShowAd(); } } else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 2) { GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd(); BGManager.Instance.partsParent.SetActive(false); GameObject [] allGUI = GameObject.FindGameObjectsWithTag("GUIManager"); foreach (GameObject curr in allGUI) { Destroy(curr); } if (NetworkManager.IsConnected()) { Defines.TURN turn = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn; Debug.Log("ttt: : " + turn); if (turn == Defines.TURN.P1 || turn == Defines.TURN.P2 || turn == Defines.TURN.NOTSTARTED) { NetworkManager.Disconnect(); } else { NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic(); networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.QUIT); GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn = Defines.TURN.DISCONNECTED; NetworkManager.Disconnect(); } } if (AudioManager.Instance) { AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK); } BGManager.Instance.partsParent.SetActive(false); BackToMainMenu(1, false); Adverts.Instance.RandomShowAd(); } }
public void BtnNewGame() { // New Game if (NetworkManager.IsConnected()) { NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic(); networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.RESTART); GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().WaitingForOtherPlayer(); } else { SceneManager.LoadScene("GameScene"); } }
public void BtnNewGame() { BGManager.Instance.partsParent.SetActive(false); if (AudioManager.Instance) { AudioManager.Instance.PlaySoundEvent(SOUNDID.BGM); } // New Game if (NetworkManager.IsConnected()) { NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic(); networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.RESTART); GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().WaitingForOtherPlayer(); } else { SceneManager.LoadScene("GameScene"); } //Adverts.Instance.RandomShowAd(); }