Files
bansonic_beta_main/Assets/playerBagSystem/bagItemPreviewPrefab.cs
T

49 lines
1.1 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class bagItemPreviewPrefab : MonoBehaviour
{
public Image btm_img;
public Image profileImage;
public Text itemName;
public Text itemToUsing;
public Text itemDescription;
public TextMeshProUGUI itemAmount;
public void Bind(Color backgroundColor, Sprite icon, string displayName, string usage, string description, string amountText)
{
if (btm_img != null)
{
btm_img.color = backgroundColor;
}
if (profileImage != null)
{
profileImage.sprite = icon;
profileImage.enabled = icon != null;
profileImage.color = Color.white;
}
if (itemName != null)
{
itemName.text = displayName ?? string.Empty;
}
if (itemToUsing != null)
{
itemToUsing.text = usage ?? string.Empty;
}
if (itemDescription != null)
{
itemDescription.text = description ?? string.Empty;
}
if (itemAmount != null)
{
itemAmount.text = amountText ?? string.Empty;
}
}
}