private void PopulateAchievements(uint authGeneration, GooglePlayGames.Native.PInvoke.AchievementManager.FetchAllResponse response) { if (authGeneration != mAuthGeneration) { Logger.d("Received achievement callback after signout occurred, ignoring"); } else { Logger.d("Populating Achievements, status = " + response.Status()); lock (AuthStateLock) { if (response.Status() != CommonErrorStatus.ResponseStatus.VALID && response.Status() != CommonErrorStatus.ResponseStatus.VALID_BUT_STALE) { Logger.e("Error retrieving achievements - check the log for more information. Failing signin."); Action <bool, string> action = mPendingAuthCallbacks; mPendingAuthCallbacks = null; if (action != null) { InvokeCallbackOnGameThread(action, false, "Cannot load achievements, Authenication failing"); } SignOut(); return; } Dictionary <string, GooglePlayGames.BasicApi.Achievement> dictionary = new Dictionary <string, GooglePlayGames.BasicApi.Achievement>(); foreach (NativeAchievement item in response) { using (item) { dictionary[item.Id()] = item.AsAchievement(); } } Logger.d("Found " + dictionary.Count + " Achievements"); mAchievements = dictionary; } Logger.d("Maybe finish for Achievements"); MaybeFinishAuthentication(); } }
private void PopulateAchievements(uint authGeneration, GooglePlayGames.Native.PInvoke.AchievementManager.FetchAllResponse response) { if ((int)authGeneration != (int)this.mAuthGeneration) { Logger.d("Received achievement callback after signout occurred, ignoring"); } else { Logger.d("Populating Achievements, status = " + (object)response.Status()); lock (this.AuthStateLock) { if (response.Status() != CommonErrorStatus.ResponseStatus.VALID && response.Status() != CommonErrorStatus.ResponseStatus.VALID_BUT_STALE) { Logger.e("Error retrieving achievements - check the log for more information. Failing signin."); Action <bool> pendingAuthCallbacks = this.mPendingAuthCallbacks; this.mPendingAuthCallbacks = (Action <bool>)null; if (pendingAuthCallbacks != null) { NativeClient.InvokeCallbackOnGameThread <bool>(pendingAuthCallbacks, false); } this.SignOut(); return; } Dictionary <string, GooglePlayGames.BasicApi.Achievement> dictionary = new Dictionary <string, GooglePlayGames.BasicApi.Achievement>(); foreach (NativeAchievement nativeAchievement in response) { using (nativeAchievement) dictionary[nativeAchievement.Id()] = nativeAchievement.AsAchievement(); } Logger.d("Found " + (object)dictionary.Count + " Achievements"); this.mAchievements = dictionary; } Logger.d("Maybe finish for Achievements"); this.MaybeFinishAuthentication(); } }