Esempio 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);
                    }
                }
            }
        }
Esempio 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);
            }
        }
Esempio 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);
        }
Esempio 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);
            }
        }
Esempio 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;
        }
Esempio 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);
                }
            }
        }