public void Cmd_Restart() { if (GameManager.GetInstance().gameOver) { NetworkGameManager.GetInstance().ServerChangeScene("Game"); Debug.Log("NetworkGameManagerFound"); //obj.GetComponent<NetworkGameManager>().ServerChangeScene("Game"); } }
/// <summary> /// When the server is shut down /// </summary> /// <param name="connection"></param> public override void OnClientDisconnect(NetworkConnection connection) { ApplicationData.ServerClosed = true; NetworkGameManager NetManager = NetworkGameManager.GetInstance(); MatchInfo matchInfo = NetManager.matchInfo; NetManager.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, NetManager.OnDropConnection); NetManager.StopHost(); NetworkGameManager.Shutdown(); SceneManager.LoadScene(0); base.OnClientDisconnect(connection); }
/// <summary> /// Quits the application. /// </summary> public void Quit() { ApplicationData.ServerClosed = false; NetworkGameManager NetManager = NetworkGameManager.GetInstance(); MatchInfo matchInfo = NetManager.matchInfo; NetManager.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, NetManager.OnDropConnection); NetManager.StopHost(); NetworkGameManager.Shutdown(); SceneManager.LoadScene(0); //SceneManager.LoadScene(0); }
// Use this for initialization void Start() { NetManager = NetworkGameManager.GetInstance(); if (NetManager.matchMaker == null) { NetManager.StartMatchMaker(); } if (ApplicationData.ServerTimeout) { Status.text = ("Server Connection Timed Out"); } else { Status.text = ""; } FindMatchButton.enabled = true; StartMatchButton.enabled = true; }
//initialize variables void Awake() { instance = this; }