Exemplo n.º 1
0
    public void AddRow(LeaderboardRowData rowData)
    {
        var rowObject = Instantiate(rowPrefab, leaderboardContainer.position, Quaternion.identity, leaderboardContainer);
        var yPosition = -1 * (rowData.rank - 1) * rowHeight;

        rowObject.transform.Translate(new Vector3(0f, yPosition, 0f));

        var row = rowObject.GetComponent <LeaderboardRow>();

        row.SetData(rowData);

        rows.Add(row);
    }
Exemplo n.º 2
0
 public void SetData(LeaderboardRowData data)
 {
     rankText.text     = data.rank.ToString();
     userNameText.text = data.userName;
     scoreText.text    = data.score.ToString();
 }