加入很多新内容,这波一块交了
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class get_item_prefab : MonoBehaviour
|
||||
{
|
||||
public Image item_btm;
|
||||
public Image itemProfile;
|
||||
public TextMeshProUGUI itemAmount;
|
||||
public Text itemName;
|
||||
|
||||
public void Bind(Sprite icon, string displayName, int amount, Color qualityColor)
|
||||
{
|
||||
if (item_btm != null)
|
||||
{
|
||||
item_btm.color = qualityColor;
|
||||
}
|
||||
|
||||
if (itemProfile != null)
|
||||
{
|
||||
itemProfile.sprite = icon;
|
||||
itemProfile.enabled = icon != null;
|
||||
itemProfile.color = icon != null ? Color.white : new Color(1f, 1f, 1f, 0f);
|
||||
}
|
||||
|
||||
if (itemName != null)
|
||||
{
|
||||
itemName.text = displayName ?? string.Empty;
|
||||
}
|
||||
|
||||
if (itemAmount != null)
|
||||
{
|
||||
if (amount <= 1)
|
||||
{
|
||||
itemAmount.text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemAmount.text = amount.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user