private void RefreshCallback(Response<LeaderboardScores> response, LeaderboardRequest request)
        {
            if (!request.Equals(_latestRequest))
            {
                return;
            }

            _isLoading = false;
            if (response.Success)
            {
                _scores.Clear();
                for (int i = 0; i < response.Data.Scores.Count; i++)
                {
                    _scores.Add(response.Data.Scores[i]);
                }

                if (response.Data.Scores.Count < request.Records)
                {
                    _canLoadMoreScores = false;
                }
            }
        }
        private void LoadPageCallback(Response<LeaderboardScores> response, LeaderboardRequest request)
        {
            // If the leaderboard has been resetted ( thus, leaderboard is not loading ) or the response is not the response to the latest request,
            // do not proceed nor update data with this response
            if (!_isLoading || !request.Equals(_latestRequest))
            {
                return;
            }

            _isLoading = false;
            if (response.Success)
            {
                _scores.Capacity = Math.Max(_scores.Capacity, _scores.Count + response.Data.Scores.Count);
                for (int i = 0; i < response.Data.Scores.Count; i++)
                {
                    _scores.Add(response.Data.Scores[i]);
                }

                if (response.Data.Scores.Count < request.Records)
                {
                    _canLoadMoreScores = false;
                }
            }
        }
Esempio n. 3
0
        private void ScoreResponseHandler(Response<SavedScore> r)
        {
            //scoreboardRanks = string.Format("Daily Rank: {0}\nWeely Rank: {1}\nOverall Rank {2}", 0, 0, 0);
            if (!r.Success)
            {
                if (Guide.IsVisible == false)
                {
                    //Guide.BeginShowMessageBox("Error", "Unable to retreive data from the server please check your network connection", new string[] { "OK" }, 0, MessageBoxIcon.Error, null, null);
                    return;
                }
            }
            else
            {
                //scoreboardRanks = string.Format("Daily Rank: {0}\nWeely Rank: {1}\nOverall Rank {2}", r.Data.Ranks.Daily, r.Data.Ranks.Weekly, r.Data.Ranks.Overall);
            }

            LoadLeaderboard(LeaderboardScope.Overall, 1);
        }
Esempio n. 4
0
 private void LeaderboardReceived(Response<LeaderboardScores> response)
 {
     if (!response.Success)
     {
         if (Guide.IsVisible == false)
         {
             //Guide.BeginShowMessageBox("Error", "Unable to retreive data from the server, please check your network connection", new string[] { "OK" }, 0, MessageBoxIcon.Error, null, null);
             return;
         }
     }
     else
     {
         for (var i = 0; i < response.Data.Scores.Count; ++i)
         {
             sblist.Add(new ScoreboardEntry(response.Data.Scores[i]));
         }
     }
 }
Esempio n. 5
0
 private void TotalResponseHandler(Response<int> r)
 {
     if (!r.Success)
     {
         if (Guide.IsVisible == false)
         {
             Guide.BeginShowMessageBox("Error", "Unable to retreive data from the server please check your network connection", new string[] { "OK" }, 0, MessageBoxIcon.Error, null, null);
             return;
         }
         // Handle any errors here
     }
     else
     {
         totalscores = r.Data;
     }
 }
Esempio n. 6
0
 private void RivalResponseHandler(Response<IList<Score>> r)
 {
     //scoreboardRanks = string.Format("Daily Rank: {0}\nWeely Rank: {1}\nOverall Rank {2}", 0, 0, 0);
     if (!r.Success)
     {
         if (Guide.IsVisible == false)
         {
             Guide.BeginShowMessageBox("Error", "Unable to retreive data from the server please check your network connection", new string[] { "OK" }, 0, MessageBoxIcon.Error, null, null);
             return;
         }
         // Handle any errors here
     }
     else
     {
         for (var i = 0; i < 3; ++i)
         {
             sblist.Add(new ScoreboardEntry(r.Data[i]));
         }
     }
 }