Files
rudder-unity-sdk/Assets/LiveOpsExamples/Scripts/UI/Rows/LeaderboardRowView.cs
T

26 lines
627 B
C#
Raw Normal View History

2026-08-12 14:03:44 +03:00
using UnityEngine.UIElements;
namespace LiveOpsExamples
{
public class LeaderboardRowView
{
private readonly Label rankLabel;
private readonly Label playerLabel;
private readonly Label scoreLabel;
public LeaderboardRowView(VisualElement root)
{
rankLabel = root.Q<Label>("lb-rank");
playerLabel = root.Q<Label>("lb-player");
scoreLabel = root.Q<Label>("lb-score");
}
public void Set(int rank, string playerName, int score)
{
rankLabel.text = rank > 0 ? $"#{rank}" : "—";
playerLabel.text = playerName;
scoreLabel.text = score.ToString();
}
}
}