thewar_client/Client/Assets/1_Script/System/itemImgPrefab.cs

27 lines
701 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class itemImgPrefab : MonoBehaviour
{
[SerializeField] private Image image;
[SerializeField] private TMP_Text count;
public void Set(Sprite image, int count)
{
this.image.sprite = image;
this.count.gameObject.SetActive(count != 0);
this.count.text = count.ToString();
gameObject.SetActive(true);
}
public void Set(Sprite image, long count)
{
this.image.sprite = image;
this.count.gameObject.SetActive(count != 0);
this.count.text = count.ToString();
gameObject.SetActive(true);
}
}