//Method to all items to the leaderboard dynamically scrollable list void CreateListItemLeaderboard(string id, string fName, string fScore = "") { ListItemLeaderboard tempItem = Instantiate(itemLeaderPref) as ListItemLeaderboard; tempItem.fId = id; tempItem.txtName.text = fName; tempItem.txtScore.text = fScore; tempItem.transform.SetParent(listLeaderboardContainer.transform, false); listLeaderboard.Add(tempItem); }
public void LoadData() { for (int i = 0; i < listLeaderboard.Count; i++) { ListItemLeaderboard tmp = Instantiate(itemLeaderPref) as ListItemLeaderboard; tmp.AssignValues(listLeaderboard[i].fId, listLeaderboard[i].picUrl, listLeaderboard[i].txtName.text, listLeaderboard[i].txtScore.text, listLeaderboard[i].imgPic.sprite); tmp.transform.SetParent(listLeaderboardContainer.transform, false); listLeaderboard[i] = tmp; } for (int j = 0; j < listInvites.Count; j++) { ListItemInvite tmp = Instantiate(itemInvitePref) as ListItemInvite; tmp.AssignValues(listInvites[j].fId, listInvites[j].picUrl, listInvites[j].txtName.text, listInvites[j].imgPic.sprite); tmp.transform.SetParent(listInviteContainer.transform, false); listInvites[j] = tmp; } }