void instantiateAdapter(int position, string playerName, int playerPosition) { HighScoreTuple tuple = scores[position]; HighScoreAdapter adapter = Instantiate(highScoreAdapter, highScorePanel.transform).GetComponent <HighScoreAdapter>(); adapter.BindData(tuple.playerName, tuple.score, position, tuple.playerName == playerName, position == playerPosition); }
public void ShowHighScores(string name, int score) { returnAllObjectsToPool(); LoadScore(); HighScoreTuple tuple = new HighScoreTuple(name, score); scores.Add(tuple); scores = scores.OrderByDescending(x => x.score).ToList(); int playerPosition = scores.IndexOf(tuple); SaveScore(); instantiateAdapters(name, playerPosition); }