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

30 lines
799 B
C#
Raw Normal View History

2026-08-12 14:03:44 +03:00
using UnityEngine;
using UnityEngine.UIElements;
namespace LiveOpsExamples
{
public class BackpackItemRowView
{
private readonly VisualElement _icon;
private readonly Label _nameLabel;
private readonly Label _metaLabel;
private readonly Label _amountLabel;
public BackpackItemRowView(VisualElement root)
{
_icon = root.Q<VisualElement>("item-icon");
_nameLabel = root.Q<Label>("item-name");
_metaLabel = root.Q<Label>("item-meta");
_amountLabel = root.Q<Label>("item-amount");
}
public void Set(Sprite icon, string itemName, string slug, int amount)
{
_icon.style.backgroundImage = new StyleBackground(icon);
_nameLabel.text = itemName;
_metaLabel.text = slug;
_amountLabel.text = $"×{amount}";
}
}
}