public void Load() { if (m_instantiatedObjects != null && m_instantiatedObjects.Count > 0) { return; } m_instantiatedObjects = new List <GameObject>(); List <LeaderboardScore> scores = GetLocalScores(); LeaderboardScore pending = GetPendingScore(); if (pending != null) { scores.Add(pending); } if (scores.Count > 0) { scores.Sort(CompareScores); } for (int i = 1; i <= m_loadedAmount; i++) { if (scores.Count < i) { break; } GameObject spotObj; bool defaultName = false; LeaderboardScore score = scores[i - 1]; if (score.Name.Length == 0 && score != pending) { defaultName = true; } spotObj = Instantiate(m_spotPrefab, transform.Find("Viewport").Find("Content")); m_instantiatedObjects.Add(spotObj); LeaderboardSpot spot = spotObj.GetComponent <LeaderboardSpot>(); if (defaultName) { score.Name = "AAA"; } if (score == pending) { spot.m_editable = true; } spot.m_loader = this; spot.Set(i, score); } }
public void Load() { if (m_instantiatedObjects != null && m_instantiatedObjects.Count > 0) { return; } m_instantiatedObjects = new List <GameObject>(); List <LeaderboardScore> scores = m_local ? GetLocalScores() : GetOnlineScores(); LeaderboardScore pending = GetPendingScore(); if (pending != null) { scores.Add(pending); } if (scores.Count > 0) { scores.Sort(CompareScores); } for (int i = 1; i <= m_loadedAmount; i++) { if (scores.Count < i) { break; } GameObject spotObj; if (scores[i - 1].Name.Length == 0) { spotObj = Instantiate(m_editableSpotPrefab, transform); } else { spotObj = Instantiate(m_spotPrefab, transform); } m_instantiatedObjects.Add(spotObj); LeaderboardSpot spot = spotObj.GetComponent <LeaderboardSpot>(); spot.m_local = m_local; spot.m_loader = this; spot.Set(i, scores[i - 1]); } }