Support legacy text component.
This commit is contained in:
parent
eac5dc0ab9
commit
8cef3f2ca9
|
@ -5,18 +5,15 @@ using UnityEngine.UI;
|
||||||
|
|
||||||
public class LeaderboardEntry : MonoBehaviour
|
public class LeaderboardEntry : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField] private TMPro.TextMeshProUGUI _numText;
|
||||||
private TMPro.TextMeshProUGUI _numText;
|
[SerializeField] private Text _numText2;
|
||||||
[SerializeField]
|
[SerializeField] private TMPro.TextMeshProUGUI _nameText;
|
||||||
private TMPro.TextMeshProUGUI _nameText;
|
[SerializeField] private Text _nameText2;
|
||||||
[SerializeField]
|
[SerializeField] private TMPro.TextMeshProUGUI _scoreText;
|
||||||
private TMPro.TextMeshProUGUI _scoreText;
|
[SerializeField] private Text _scoreText2;
|
||||||
[SerializeField]
|
[SerializeField] private Image _lable;
|
||||||
private Image _lable;
|
[SerializeField] private Image _selectBackground;
|
||||||
[SerializeField]
|
[SerializeField] private Sprite _goldLable;
|
||||||
private Image _selectBackground;
|
|
||||||
[SerializeField]
|
|
||||||
private Sprite _goldLable;
|
|
||||||
|
|
||||||
public int MaxIndex = 29;
|
public int MaxIndex = 29;
|
||||||
|
|
||||||
|
@ -32,20 +29,39 @@ public class LeaderboardEntry : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index <= MaxIndex)
|
if (index <= MaxIndex)
|
||||||
_numText.SetText($"{index + 1}");
|
{
|
||||||
|
if(_numText != default)
|
||||||
|
_numText.SetText($"{index + 1}");
|
||||||
|
if(_numText2 != default)
|
||||||
|
_numText2.text = $"{index + 1}";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_numText.SetText($"-");
|
{
|
||||||
|
if(_numText != default)
|
||||||
|
_numText.SetText($"-");
|
||||||
|
if(_numText2 != default)
|
||||||
|
_numText2.text = $"-";
|
||||||
|
}
|
||||||
|
|
||||||
_scoreText.SetText($"{player.Score}");
|
if(_scoreText != default)
|
||||||
|
_scoreText.SetText($"{player.Score}");
|
||||||
|
if(_scoreText2 != default)
|
||||||
|
_scoreText2.text = $"{player.Score}";
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
_nameText.SetText("ÂÛ");
|
if(_nameText != default)
|
||||||
|
_nameText.SetText("ÂÛ");
|
||||||
|
if(_nameText2 != default)
|
||||||
|
_nameText2.text = "ÂÛ";
|
||||||
_selectBackground.gameObject.SetActive(true);
|
_selectBackground.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_nameText.SetText(player.Name);
|
if(_nameText != default)
|
||||||
|
_nameText.SetText(player.Name);
|
||||||
|
if(_nameText2 != default)
|
||||||
|
_nameText2.text = player.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue