30 lines
852 B
C#
Executable File
30 lines
852 B
C#
Executable File
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
public class LeaderboardItem : MonoBehaviour
|
|
{
|
|
public TMP_Text positionTxt;
|
|
public Image img_place;
|
|
public Image img_rank;
|
|
public Sprite[] specialPlaces;
|
|
public TMP_Text usernameTxt;
|
|
public TMP_Text trophiesTxt;
|
|
|
|
public void Set(LeaderboardUserData data){
|
|
positionTxt.text = data.position.ToString();
|
|
if(data.position > specialPlaces.Length){
|
|
img_place.enabled = false;
|
|
}else{
|
|
img_place.enabled = true;
|
|
img_place.sprite = specialPlaces[data.position-1];
|
|
}
|
|
|
|
usernameTxt.text = data.username;
|
|
trophiesTxt.text = data.trophies.ToString();
|
|
|
|
img_rank.sprite = DBmanager.GetRankForTrophies(data.trophies).image;
|
|
}
|
|
}
|