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