Files
rudder-unity-sdk/Assets/LiveOpsExamples/Scripts/UI/Rows/BackpackItemRowView.cs
T
2026-08-12 14:03:44 +03:00

30 lines
799 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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}";
}
}
}