コード例 #1
0
ファイル: NativeClient.cs プロジェクト: zunaalabaya/TAC-BOT
        private void HandleAuthTransition(Types.AuthOperation operation, CommonErrorStatus.AuthStatus status)
        {
            Logger.d("Starting Auth Transition. Op: " + (object)operation + " status: " + (object)status);
            lock (this.AuthStateLock)
            {
                switch (operation)
                {
                case Types.AuthOperation.SIGN_IN:
                    if (status == CommonErrorStatus.AuthStatus.VALID)
                    {
                        // ISSUE: object of a compiler-generated type is created
                        // ISSUE: variable of a compiler-generated type
                        NativeClient.\u003CHandleAuthTransition\u003Ec__AnonStorey10E transitionCAnonStorey10E = new NativeClient.\u003CHandleAuthTransition\u003Ec__AnonStorey10E();
                        // ISSUE: reference to a compiler-generated field
                        transitionCAnonStorey10E.\u003C\u003Ef__this = this;
                        if (this.mSilentAuthCallbacks != null)
                        {
                            this.mPendingAuthCallbacks += this.mSilentAuthCallbacks;
                            this.mSilentAuthCallbacks   = (Action <bool>)null;
                        }
                        // ISSUE: reference to a compiler-generated field
                        transitionCAnonStorey10E.currentAuthGeneration = this.mAuthGeneration;
                        // ISSUE: reference to a compiler-generated method
                        this.mServices.AchievementManager().FetchAll(new Action <GooglePlayGames.Native.PInvoke.AchievementManager.FetchAllResponse>(transitionCAnonStorey10E.\u003C\u003Em__20));
                        // ISSUE: reference to a compiler-generated method
                        this.mServices.PlayerManager().FetchSelf(new Action <GooglePlayGames.Native.PInvoke.PlayerManager.FetchSelfResponse>(transitionCAnonStorey10E.\u003C\u003Em__21));
                        break;
                    }
                    if (this.mAuthState == NativeClient.AuthState.SilentPending)
                    {
                        this.mSilentAuthFailed = true;
                        this.mAuthState        = NativeClient.AuthState.Unauthenticated;
                        Action <bool> silentAuthCallbacks = this.mSilentAuthCallbacks;
                        this.mSilentAuthCallbacks = (Action <bool>)null;
                        Debug.Log((object)"Invoking callbacks, AuthState changed from silentPending to Unauthenticated.");
                        NativeClient.InvokeCallbackOnGameThread <bool>(silentAuthCallbacks, false);
                        if (this.mPendingAuthCallbacks == null)
                        {
                            break;
                        }
                        Debug.Log((object)"there are pending auth callbacks - starting AuthUI");
                        this.GameServices().StartAuthorizationUI();
                        break;
                    }
                    Debug.Log((object)("AuthState == " + (object)this.mAuthState + " calling auth callbacks with failure"));
                    Action <bool> pendingAuthCallbacks = this.mPendingAuthCallbacks;
                    this.mPendingAuthCallbacks = (Action <bool>)null;
                    NativeClient.InvokeCallbackOnGameThread <bool>(pendingAuthCallbacks, false);
                    break;

                case Types.AuthOperation.SIGN_OUT:
                    this.ToUnauthenticated();
                    break;

                default:
                    Logger.e("Unknown AuthOperation " + (object)operation);
                    break;
                }
            }
        }
コード例 #2
0
        private void HandleAuthTransition(Types.AuthOperation operation, CommonErrorStatus.AuthStatus status)
        {
            Logger.d("Starting Auth Transition. Op: " + operation + " status: " + status);
            lock (AuthStateLock)
            {
                switch (operation)
                {
                case Types.AuthOperation.SIGN_IN:
                    if (status == CommonErrorStatus.AuthStatus.VALID)
                    {
                        if (mSilentAuthCallbacks != null)
                        {
                            mPendingAuthCallbacks = (Action <bool, string>)Delegate.Combine(mPendingAuthCallbacks, mSilentAuthCallbacks);
                            mSilentAuthCallbacks  = null;
                        }
                        uint currentAuthGeneration = mAuthGeneration;
                        mServices.AchievementManager().FetchAll(delegate(GooglePlayGames.Native.PInvoke.AchievementManager.FetchAllResponse results)
                        {
                            PopulateAchievements(currentAuthGeneration, results);
                        });
                        mServices.PlayerManager().FetchSelf(delegate(GooglePlayGames.Native.PInvoke.PlayerManager.FetchSelfResponse results)
                        {
                            PopulateUser(currentAuthGeneration, results);
                        });
                    }
                    else if (mAuthState == AuthState.SilentPending)
                    {
                        mSilentAuthFailed = true;
                        mAuthState        = AuthState.Unauthenticated;
                        Action <bool, string> callback = mSilentAuthCallbacks;
                        mSilentAuthCallbacks = null;
                        Logger.d("Invoking callbacks, AuthState changed from silentPending to Unauthenticated.");
                        InvokeCallbackOnGameThread(callback, false, "silent auth failed");
                        if (mPendingAuthCallbacks != null)
                        {
                            Logger.d("there are pending auth callbacks - starting AuthUI");
                            GameServices().StartAuthorizationUI();
                        }
                    }
                    else
                    {
                        Logger.d("AuthState == " + mAuthState + " calling auth callbacks with failure");
                        UnpauseUnityPlayer();
                        Action <bool, string> callback2 = mPendingAuthCallbacks;
                        mPendingAuthCallbacks = null;
                        InvokeCallbackOnGameThread(callback2, false, "Authentication failed");
                    }
                    break;

                case Types.AuthOperation.SIGN_OUT:
                    ToUnauthenticated();
                    break;

                default:
                    Logger.e("Unknown AuthOperation " + operation);
                    break;
                }
            }
        }
コード例 #3
0
 private static void InternalAuthFinishedCallback(Types.AuthOperation op, CommonErrorStatus.AuthStatus status, IntPtr data)
 {
     GameServicesBuilder.AuthFinishedCallback permanentCallback = Callbacks.IntPtrToPermanentCallback <GameServicesBuilder.AuthFinishedCallback>(data);
     if (permanentCallback == null)
     {
         return;
     }
     try
     {
         permanentCallback(op, status);
     }
     catch (Exception ex)
     {
         Logger.e("Error encountered executing InternalAuthFinishedCallback. Smothering to avoid passing exception into Native: " + (object)ex);
     }
 }
コード例 #4
0
        private static void InternalAuthFinishedCallback(Types.AuthOperation op, CommonErrorStatus.AuthStatus status, IntPtr data)
        {
            AuthFinishedCallback authFinishedCallback = Callbacks.IntPtrToPermanentCallback <AuthFinishedCallback>(data);

            if (authFinishedCallback != null)
            {
                try
                {
                    authFinishedCallback(op, status);
                }
                catch (Exception arg)
                {
                    Logger.e("Error encountered executing InternalAuthFinishedCallback. Smothering to avoid passing exception into Native: " + arg);
                }
            }
        }
コード例 #5
0
        private static void InternalAuthFinishedCallback(Types.AuthOperation op,
                                                         CommonErrorStatus.AuthStatus status, IntPtr data)
        {
            var callback =
                Callbacks.IntPtrToPermanentCallback <AuthFinishedCallback>(data);

            if (callback == null)
            {
                return;
            }

            try
            {
                callback(op, status);
            }
            catch (Exception e)
            {
                Logger.e("Error encountered executing InternalAuthFinishedCallback. " +
                         "Smothering to avoid passing exception into Native: " + e);
            }
        }