in Assets/Xbox Live/Scripts/Leaderboard.cs [388:446]
private void LoadResult(LeaderboardResult result)
{
if (this.stat == null || (result.HasNext && (this.stat.ID != result.GetNextQuery().StatName || this.socialGroup != result.GetNextQuery().SocialGroup)))
{
return;
}
this.leaderboardData = result;
uint displayCurrentPage = this.currentPage + 1;
if (this.leaderboardData.TotalRowCount == 0)
{
this.totalPages = 0;
displayCurrentPage = 0;
}
else if (this.totalPages == 0)
{
this.totalPages = this.leaderboardData.TotalRowCount / this.entryCount;
}
this.pageText.text = string.Format("{0} | {1}", displayCurrentPage, Mathf.Max(displayCurrentPage, this.totalPages));
this.Clear();
IList<string> xuids = new List<string>();
var rowCount = 0;
foreach (LeaderboardRow row in this.leaderboardData.Rows)
{
xuids.Add(row.XboxUserId);
GameObject entryObject = this.entryObjectPool.GetObject();
PlayerProfile entry = entryObject.GetComponent<PlayerProfile>();
entry.Theme = this.Theme;
entry.IsCurrentPlayer = this.xboxLiveUser != null && row.Gamertag.Equals(this.xboxLiveUser.Gamertag);
entry.BackgroundColor = ((rowCount % 2 == 0) ? PlayerProfileBackgrounds.RowBackground02 : PlayerProfileBackgrounds.RowBackground01);
entry.UpdateGamerTag(row.Gamertag);
entry.UpdateRank(true, row.Rank);
if (row.Values != null && row.Values.Count > 0)
{
entry.UpdateScore(true, row.Values[0]);
}
this.StartCoroutine(entry.Reload());
entryObject.transform.SetParent(this.contentPanel);
this.currentEntries.Add(entry);
rowCount++;
entryObject.transform.localScale = Vector3.one;
}
if (xuids.Count > 0)
{
userGroup = XboxLive.Instance.SocialManager.CreateSocialUserGroupFromList(this.xboxLiveUser, xuids);
}
// Reset the scroll view to the top.
this.scrollRect.verticalNormalizedPosition = 1;
this.UpdateButtons();
}