2024-12-21 19:57:23 +08:00

29 lines
751 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ItemObj : MonoBehaviour
{
[SerializeField] private Image icon;
[SerializeField] private GameObject back;
[SerializeField] private Text name;
[SerializeField] private Text num;
[SerializeField] public int itemId;
public void SetData(int id,int n=0)
{
itemId = id;
var data = JsonTab.Instance.tables.Item.Get(id);
icon.sprite = AssetBundleManager.ins.Sprite(data.Icon, AtlasType.ItemIcon);
name.text = data.Propname;
num.text = n.ToString();
if (back != null)
{
back.gameObject.SetActive(!DataManager.GetItemUnLock(id));
}
}
}