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; } } }
private void InitializeGameServices() { lock (this.GameServicesLock) { if (this.mServices != null) { return; } using (GameServicesBuilder gameServicesBuilder = GameServicesBuilder.Create()) { using (PlatformConfiguration platformConfiguration = this.clientImpl.CreatePlatformConfiguration()) { this.RegisterInvitationDelegate(this.mConfiguration.InvitationDelegate); gameServicesBuilder.SetOnAuthFinishedCallback(new GameServicesBuilder.AuthFinishedCallback(this.HandleAuthTransition)); gameServicesBuilder.SetOnTurnBasedMatchEventCallback((Action <Types.MultiplayerEvent, string, NativeTurnBasedMatch>)((eventType, matchId, match) => this.mTurnBasedClient.HandleMatchEvent(eventType, matchId, match))); gameServicesBuilder.SetOnMultiplayerInvitationEventCallback(new Action <Types.MultiplayerEvent, string, GooglePlayGames.Native.PInvoke.MultiplayerInvitation>(this.HandleInvitation)); if (this.mConfiguration.EnableSavedGames) { gameServicesBuilder.EnableSnapshots(); } Debug.Log((object)"Building GPG services, implicitly attempts silent auth"); this.mAuthState = NativeClient.AuthState.SilentPending; this.mServices = gameServicesBuilder.Build(platformConfiguration); this.mEventsClient = (IEventsClient) new NativeEventClient(new GooglePlayGames.Native.PInvoke.EventManager(this.mServices)); this.mQuestsClient = (IQuestsClient) new NativeQuestClient(new GooglePlayGames.Native.PInvoke.QuestManager(this.mServices)); this.mTurnBasedClient = new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(this.mServices)); this.mTurnBasedClient.RegisterMatchDelegate(this.mConfiguration.MatchDelegate); this.mRealTimeClient = new NativeRealtimeMultiplayerClient(this, new RealtimeManager(this.mServices)); this.mSavedGameClient = !this.mConfiguration.EnableSavedGames ? (ISavedGameClient) new UnsupportedSavedGamesClient("You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames.") : (ISavedGameClient) new NativeSavedGameClient(new GooglePlayGames.Native.PInvoke.SnapshotManager(this.mServices)); this.mAuthState = NativeClient.AuthState.SilentPending; this.mTokenClient = this.clientImpl.CreateTokenClient(); } } } }
private void ToUnauthenticated() { lock (this.AuthStateLock) { this.mUser = (GooglePlayGames.BasicApi.Multiplayer.Player)null; this.mFriends = (List <GooglePlayGames.BasicApi.Multiplayer.Player>)null; this.mAchievements = (Dictionary <string, GooglePlayGames.BasicApi.Achievement>)null; this.mAuthState = NativeClient.AuthState.Unauthenticated; ++this.mAuthGeneration; } }
private void MaybeFinishAuthentication() { Action <bool> callback = (Action <bool>)null; lock (this.AuthStateLock) { if (this.mUser == null || this.mAchievements == null) { Logger.d("Auth not finished. User="******" achievements=" + (object)this.mAchievements); return; } Logger.d("Auth finished. Proceeding."); callback = this.mPendingAuthCallbacks; this.mPendingAuthCallbacks = (Action <bool>)null; this.mAuthState = NativeClient.AuthState.Authenticated; } if (callback == null) { return; } Logger.d("Invoking Callbacks: " + (object)callback); NativeClient.InvokeCallbackOnGameThread <bool>(callback, true); }