Exemplo n.º 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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void RequestUserPage(CoLeaderboardPage page, LeaderboardPageLoadDelegate pageCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null)
                {
                    throw new Exception("Previous leaderboard page request still being processed");
                }

                _leaderboardPageLoadDelegate     = pageCompleteDelegate;
                _currentlyLoadingLeaderboardPage = page;
                page.RequestUserPage(Session.UserId);
            }
        }
Exemplo n.º 3
0
        public CoLeaderboardPage RequestOpenLeaderboard(int leaderboardId, int pageSize, LeaderboardPageLoadDelegate pageCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null)
                {
                    throw new Exception("Previous leaderboard page request still being processed");
                }

                _leaderboardPageLoadDelegate     = pageCompleteDelegate;
                _currentlyLoadingLeaderboardPage = _leaderboardsManager.GetLeaderboardFromId(leaderboardId).GetGlobalPage((uint)pageSize);
                return(_currentlyLoadingLeaderboardPage);
            }

            return(null);
        }
Exemplo n.º 4
0
        public void RequestUserPage(CoLeaderboardPage page, LeaderboardPageLoadDelegate pageCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null)
                    throw new Exception("Previous leaderboard page request still being processed");

                _leaderboardPageLoadDelegate = pageCompleteDelegate;
                _currentlyLoadingLeaderboardPage = page;
                page.RequestUserPage(Session.UserId);
            }
        }
Exemplo n.º 5
0
        public CoLeaderboardPage RequestOpenLeaderboard(int leaderboardId, int pageSize, LeaderboardPageLoadDelegate pageCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_currentlyLoadingLeaderboardPage != null)
                    throw new Exception("Previous leaderboard page request still being processed");

                _leaderboardPageLoadDelegate = pageCompleteDelegate;
                _currentlyLoadingLeaderboardPage = _leaderboardsManager.GetLeaderboardFromId(leaderboardId).GetGlobalPage((uint) pageSize);
                return _currentlyLoadingLeaderboardPage;
            }

            return null;
        }
Exemplo n.º 6
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);
                }
            }
        }