/// <summary>
        /// Updates the Published field for the given achievements for the given user.
        /// </summary>
        /// <param name="facebookUserId">The facebook user id.</param>
        /// <param name="achievementIds">The ids of the achievements to publish.</param>
        /// <returns>
        /// true if successful, else false.
        /// </returns>
        public bool PublishAchievements(long facebookUserId, IEnumerable <int> achievementIds)
        {
            if (achievementIds == null)
            {
                throw new ArgumentNullException("achievementIds");
            }

            _achievementManager.UpdatePublished(facebookUserId, achievementIds);

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Publishes the last 5 achievements added within the last 5 minutes for the given user.
        /// </summary>
        /// <param name="facebookUserId">The facebook user id.</param>
        /// <param name="steamUserId">The steam user id.</param>
        /// <returns>true if successful, else false.</returns>
        public bool PublishLatestAchievements(long facebookUserId, string steamUserId)
        {
            if (steamUserId == null)
            {
                throw new ArgumentNullException("steamUserId");
            }

            IEnumerable<Data.Achievement> dataAchievements = _achievementManager.GetLatestAchievements(steamUserId);
            IEnumerable<Game> games = from game in _communityService.GetGames(steamUserId)
                                      where game.PlayedRecently
                                      select game;

            if (dataAchievements.Any())
            {
                AchievementsPublisher publisher = new AchievementsPublisher();
                publisher.Publish(dataAchievements.ToAchievements(games), steamUserId, facebookUserId);

                _achievementManager.UpdatePublished(steamUserId, dataAchievements.Select(achievement => achievement.Id));
            }

            return true;
        }
        /// <summary>
        /// Updates the Published field for the given achievements for the given user.
        /// </summary>
        /// <param name="steamUserId">The steam user id.</param>
        /// <param name="achievementIds">The ids of the achievements to publish.</param>
        /// <returns>
        /// true if successful, else false.
        /// </returns>
        public bool PublishAchievements(string steamUserId, IEnumerable <int> achievementIds)
        {
            if (steamUserId == null)
            {
                throw new ArgumentNullException("steamUserId");
            }

            if (achievementIds == null)
            {
                throw new ArgumentNullException("achievementIds");
            }

            _achievementManager.UpdatePublished(steamUserId, achievementIds);

            return(true);
        }