private IEnumerator ConnectCoroutine() { OnlineManager.Connect(); while (true) { yield return(new WaitForSeconds(1)); if (OnlineManager.IsConnectionFailed()) { var exn = OnlineManager.GetConnectionError(); var errorTitle = "Connection failed"; if (exn == null) { ShowErrorPanel(errorTitle, "Something goes wrong"); } else { var errorDesc = exn is HttpRequestException ? "Can't connect to the server" : exn.Message; ShowErrorPanel(errorTitle, errorDesc); } Debug.LogError("Connection failed. \n" + exn); yield break; } if (OnlineManager.IsConnected()) { Debug.Log("Connected"); SceneManager.LoadScene("MainScene"); yield break; } } }
public void StopConnect() { OnlineManager.StopConnection(); SetActivePanel(_onlinePanel); }