void CreateScoreEntry(int place, CSVScoreEntry entry) { GameObject obj = (GameObject)Instantiate(_leaderboardEntryPrefab, _scrollParent); LeaderboardEntry leaderboardEntry = obj.GetComponent <LeaderboardEntry>(); leaderboardEntry.SetupWithScoreEntry(place, entry); }
void ProcessScoreLine(string line) { Debug.Log("Got score line of " + line); string[] parts = line.Split(','); //index 1 is name and index 3 is score CSVScoreEntry entry = new CSVScoreEntry(); entry.name = parts[1]; entry.score = Convert.ToInt32(parts[3]); Debug.Log("Adding csv score entry with name: " + entry.name + " score: " + entry.score); _sortedScores.Add(entry); }
public void SetupWithScoreEntry(int place, CSVScoreEntry entry) { _txtPlace.text = place.ToString(); string name = entry.name; if (name.Length >= MAX_LENGHT) name = entry.name.Substring(0, MAX_LENGHT); _txtName.text = name; _txtScore.text = entry.score.ToString(); if (place > 5) { _appcoinsContainer.SetActive(false); _cell.color = new Color(0, 0, 0, 0); } else { _cell.color = top5PlacesCellColors[place - 1]; _txtPlace.color = top5placesTextColor; _appcoinsContainer.SetActive(true); _txtAppcoins.text = GameManager.Instance.GetAppcoinsRewardForPlace(place).ToString(); } }