2023-07-24 16:38:13 +03:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
2023-10-02 19:12:35 +03:00
|
|
|
|
using UnityEngine.UI;
|
2023-07-24 16:38:13 +03:00
|
|
|
|
|
|
|
|
|
public class LeaderboardEntry : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private TMPro.TextMeshProUGUI _numText;
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private TMPro.TextMeshProUGUI _nameText;
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private TMPro.TextMeshProUGUI _scoreText;
|
2023-10-02 19:12:35 +03:00
|
|
|
|
[SerializeField]
|
|
|
|
|
private Image _background;
|
|
|
|
|
|
|
|
|
|
public Color SelectColor;
|
2023-07-24 16:38:13 +03:00
|
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private List<GameObject> _medals = new List<GameObject>();
|
|
|
|
|
|
2023-08-22 15:41:12 +03:00
|
|
|
|
public void Init(Player player, int index, bool selected = false)
|
2023-07-24 16:38:13 +03:00
|
|
|
|
{
|
|
|
|
|
if (index < 3)
|
|
|
|
|
{
|
|
|
|
|
_medals[index].SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_numText.SetText($"{index + 1}");
|
|
|
|
|
_nameText.SetText(player.Name);
|
|
|
|
|
_scoreText.SetText($"{player.Score}");
|
2023-08-22 15:41:12 +03:00
|
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
|
{
|
2023-10-02 19:12:35 +03:00
|
|
|
|
_background.color = SelectColor;
|
|
|
|
|
_nameText.SetText("<22><>");
|
2023-08-22 15:41:12 +03:00
|
|
|
|
}
|
2023-07-24 16:38:13 +03:00
|
|
|
|
}
|
|
|
|
|
}
|