static IEnumerator AuthenticateRoutine(Completer completer) { void FailInitialization(Completer aCompleter, Exception reason) { Unauthenticate(); Debug.LogWarning($"{nameof(GameAuthSdk)} failed to authenticate: {reason}"); _sAuthenticationStatus = AuthenticationStatus.Failed; aCompleter.Reject(reason); //Raise event. authenticatedFailed?.Invoke(reason); } Promises.GetHandles(out var dalInitDeferred, out var dalInitCompleter); try { authLayer.Authenticate(dalInitCompleter); } catch (Exception e) { dalInitCompleter.Reject(e); } if (!dalInitDeferred.isDone) { yield return(dalInitDeferred.Wait()); } var isFulfilled = dalInitDeferred.isFulfilled; var error = dalInitDeferred.error; dalInitDeferred.Release(); if (!isFulfilled) { FailInitialization(completer, error); yield break; } _sAuthenticationStatus = AuthenticationStatus.Authenticated; Debug.Log($"Successfully authenticated Game Auth version {currentVersion}"); completer.Resolve(); //Raise event. authenticated?.Invoke(); }
public override void Authenticate(Completer completer) { Id = System.Guid.NewGuid().ToString(); completer.Resolve(); }