private IEnumerator SendAuthorizationRequest(string userId, int gameVersion) { var request = new Requests.User.AuthorizationRequest(userId, gameVersion); yield return(CoroutineManager.StartCoroutine(_client.Send <Requests.User.AuthorizationRequest, BooleanResponse>(request))); if (request.Response.HasError) { LastError = new RDataException(request.Response.Error); } else { Authorized = request.Response.Result; UserId = userId; } }
public IEnumerator Authorize() { if (_client.Authorized) { LastError = new RDataException("Already authorized"); yield break; } if (string.IsNullOrEmpty(UserId)) { LastError = new RDataException("You must set the user id on the authorization strategy to authorize"); yield break; } yield return(CoroutineManager.StartCoroutine(SendAuthorizationRequest(UserId, _client.GameVersion))); if (_client.Authorized) { _client.OnAuthorized(); } }