private void TryConnect() { ShowLoader(); Authenticator.Auth(status => { switch (status) { case Authenticator.AuthStatus.Success: OnLoginSuccess(); break; case Authenticator.AuthStatus.InvalidToken: ShowError("Invalid Token\nPlease Login"); break; case Authenticator.AuthStatus.WrongCredentials: ShowError("Wrong username or password\nPlease Login"); break; case Authenticator.AuthStatus.Error: ShowError("Connection problems\nPlease try again"); connectRetryButton.gameObject.SetActive(true); break; default: throw new ArgumentOutOfRangeException(nameof(status), status, null); } }, error => { ShowError("Could not connect to server.\nPlease check your internet connection and try again"); connectRetryButton.gameObject.SetActive(true); }); }
private void Authorize() { Authenticator.Auth(status => { if (status == Authenticator.AuthStatus.Success) { SceneManager.LoadScene(SceneWorldSelect); } else { preloaderOverlay.SetActive(false); Color color = Color.black; color.a = 0.85f; preloaderOverlay.GetComponent <Image>().color = color; } }, e => throw e); }