Ejemplo n.º 1
0
    private void PopulateAchievements(uint authGeneration,
                                      AchievementManager.FetchAllResponse response) {

        if (authGeneration != mAuthGeneration) {
            Logger.d("Received achievement callback after signout occurred, ignoring");
            return;
        }

        Logger.d("Populating Achievements");
        lock (AuthStateLock) {
            if (response.Status() != Status.ResponseStatus.VALID &&
                response.Status() != Status.ResponseStatus.VALID_BUT_STALE) {
                Logger.e("Error retrieving achievements - check the log for more information. " +
                    "Failing signin.");
                var localLoudAuthCallbacks = mPendingAuthCallbacks;
                mPendingAuthCallbacks = null;

                if (localLoudAuthCallbacks != null) {
                    InvokeCallbackOnGameThread(localLoudAuthCallbacks, false);
                }
                SignOut();
                return;
            }

            var achievements = new Dictionary<string, Achievement>();
            foreach (var achievement in response) {
                using (achievement) {
                    achievements[achievement.Id()] = achievement.AsAchievement();
                }
            }
            mAchievements = achievements;
        }

        Logger.d("Maybe finish for Achievements");
        MaybeFinishAuthentication();
    }