29 lines
751 B
C#
Raw Normal View History

2024-12-16 17:25:10 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ItemObj : MonoBehaviour
{
[SerializeField] private Image icon;
2024-12-21 19:57:23 +08:00
[SerializeField] private GameObject back;
2024-12-16 17:25:10 +08:00
[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();
2024-12-21 19:57:23 +08:00
if (back != null)
{
back.gameObject.SetActive(!DataManager.GetItemUnLock(id));
}
2024-12-16 17:25:10 +08:00
}
}