49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LeaderboardEntry : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private TMPro.TextMeshProUGUI _numText;
|
|
[SerializeField]
|
|
private TMPro.TextMeshProUGUI _nameText;
|
|
[SerializeField]
|
|
private TMPro.TextMeshProUGUI _scoreText;
|
|
[SerializeField]
|
|
private Image _background;
|
|
|
|
public Color SelectColor;
|
|
|
|
public int MaxIndex = 29;
|
|
|
|
[SerializeField]
|
|
private List<GameObject> _medals = new List<GameObject>();
|
|
|
|
public void Init(Player player, int index, bool selected = false)
|
|
{
|
|
if (index < 3)
|
|
{
|
|
_medals[index].SetActive(true);
|
|
}
|
|
|
|
if (index <= MaxIndex)
|
|
_numText.SetText($"{index + 1}");
|
|
else
|
|
_numText.SetText($"-");
|
|
|
|
_scoreText.SetText($"{player.Score}");
|
|
|
|
if (selected)
|
|
{
|
|
_background.color = SelectColor;
|
|
_nameText.SetText("ÂÛ");
|
|
}
|
|
else
|
|
{
|
|
_nameText.SetText(player.Name);
|
|
}
|
|
}
|
|
}
|