private void Start() { if (NetworkClient.active == false) #if UNITY_EDITOR { NetworkConnector.TryStartServer(false); } #else { NetworkConnector.TryStartServer(true); }
private IEnumerator WaitAndConnect() { NetworkConnector.TryStartServer(false); yield return(null); UIManager.Instance.ShowNotification("Could not connect to server!"); gameObject.SetActive(false); }
private void OnPlannedDisconnect() { if (RegionDict.Instance.Region == Region.Lobby) { NetworkConnector.TryStartServer(false); return; } GlobalsDict.Instance.StartCoroutine(RegionSceneLoader.Instance.LoadScene(Region.Lobby)); }
private void OnSuddenDisconnect() { string reason; bool removeLastConnectedGame = true; switch (expectingDisconnectType) { case DisconnectMessage.Type.PasswordWrong: reason = "Could not join server! Entered password is wrong!"; break; case DisconnectMessage.Type.ServerFull: reason = "Could not join server! The server is already full!"; break; case DisconnectMessage.Type.Kicked: reason = "You were kicked from the server!"; break; case DisconnectMessage.Type.JoinedGameInProgress: reason = "Could not join server! Game already in progress!"; break; default: reason = "Lost connection to the server!"; removeLastConnectedGame = false; break; } if (removeLastConnectedGame) { Config.Instance.LastConnectedGame = null; } else { Config.Instance.LastConnectedGame = LastConnectedGame.Disconnected(Config.Instance.LastConnectedGame); } if (RegionDict.Instance.Region == Region.Lobby) { NetworkConnector.TryStartServer(false); UIManager.Instance.ShowNotification(reason); return; } UIManager.Instance.OptionsManager.ShowLostConnectionScreen(expectingDisconnectType == DisconnectMessage.Type.Kicked); }