Example #1
0
        /// <summary>
        /// Updates the object and its contained resources.
        /// </summary>
        /// <param name="gameTime"/>
        public void Update(GameTime gameTime)
        {
            Session.UpdateSession();

            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null && _currentlyLoadingLeaderboardPage.PopulationState != LeaderboardPopulationState.LPS_PENDING)
                {
                    bool success = _currentlyLoadingLeaderboardPage.PopulationState == LeaderboardPopulationState.LPS_POPULATED;
                    _currentlyLoadingLeaderboardPage = null;
                    if (_leaderboardPageLoadDelegate != null)
                    {
                        _leaderboardPageLoadDelegate.Invoke(success);
                    }
                }

                if (_currentlyLoadingUserScores != null && _currentlyLoadingUserScores.PopulationState != LeaderboardPopulationState.LPS_PENDING)
                {
                    CoLeaderboardUserRows scores = _currentlyLoadingUserScores;
                    _currentlyLoadingUserScores = null;
                    if (_userScoresLoadDelegate != null)
                    {
                        _userScoresLoadDelegate.Invoke(scores.PopulationState == LeaderboardPopulationState.LPS_POPULATED ? scores : null);
                    }
                }
            }
        }
Example #2
0
        public CoLeaderboardUserRows RequestUsersScores(UserScoresLoadDelegate scoresCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingUserScores != null)
                {
                    throw new Exception("Previous user scores request still being processed");
                }

                _userScoresLoadDelegate     = scoresCompleteDelegate;
                _currentlyLoadingUserScores = _leaderboardsManager.GetUsersScores(Session.UserId);
                return(_currentlyLoadingUserScores);
            }

            return(null);
        }
Example #3
0
        public CoLeaderboardUserRows RequestUsersScores(UserScoresLoadDelegate scoresCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingUserScores != null)
                    throw new Exception("Previous user scores request still being processed");

                _userScoresLoadDelegate = scoresCompleteDelegate;
                _currentlyLoadingUserScores = _leaderboardsManager.GetUsersScores(Session.UserId);
                return _currentlyLoadingUserScores;
            }

            return null;
        }
Example #4
0
        /// <summary>
        /// Updates the object and its contained resources.
        /// </summary>
        /// <param name="gameTime"/>
        public void Update(GameTime gameTime)
        {
            Session.UpdateSession();

            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null && _currentlyLoadingLeaderboardPage.PopulationState != LeaderboardPopulationState.LPS_PENDING)
                {
                    bool success = _currentlyLoadingLeaderboardPage.PopulationState == LeaderboardPopulationState.LPS_POPULATED;
                    _currentlyLoadingLeaderboardPage = null;
                    if (_leaderboardPageLoadDelegate != null)
                        _leaderboardPageLoadDelegate.Invoke(success);
                }

                if (_currentlyLoadingUserScores != null && _currentlyLoadingUserScores.PopulationState != LeaderboardPopulationState.LPS_PENDING)
                {
                    CoLeaderboardUserRows scores = _currentlyLoadingUserScores;
                    _currentlyLoadingUserScores = null;
                    if (_userScoresLoadDelegate != null)
                        _userScoresLoadDelegate.Invoke(scores.PopulationState == LeaderboardPopulationState.LPS_POPULATED ? scores : null);
                }
            }
        }