コード例 #1
0
        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();
        }
コード例 #2
0
        public override void Authenticate(Completer completer)
        {
            Id = System.Guid.NewGuid().ToString();

            completer.Resolve();
        }