using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class ItemDrawingButton : MonoBehaviour { [SerializeField] private FreePanel _panel; [SerializeField] private int id; [SerializeField] private Image _image; [SerializeField] private TextMeshProUGUI numPro; [SerializeField] private GameObject obj; [SerializeField] private TextMeshProUGUI buyNum; private int buy = 0; private void Awake() { } // Start is called before the first frame update void Start() { } private void OnEnable() { } // Update is called once per frame void Update() { } private void OnDisable() { } public void SendID() { if (DataManager.GetItem(id)-FreePanel.ins.slotNum(id)>0) { FreePanel.ins.SaveSeledID(id); } } public void SetItemData(int dataID,FreePanel panel) { id = dataID; _panel = panel; var data=JsonTab.Instance.tables.Item.Get(id); _image.sprite = AssetBundleManager.ins.Sprite(data.Icon, AtlasType.ItemIcon); numPro.text = (DataManager.GetItem(id)-GameSystem.ins.drawingManager.slotNum(id)).ToString(); if (DataManager.GetItem(id)-GameSystem.ins.drawingManager.slotNum(id)==0) { var num = GameSystem.ins.DataAsset.ItemValue(dataID); if (num>0) { obj.SetActive(true); numPro.gameObject.SetActive(false); buyNum.text = num.ToString(); buy = num; } else { obj.SetActive(false); numPro.gameObject.SetActive(true); } } else { obj.SetActive(false); numPro.gameObject.SetActive(true); } } private void OnMouseDown() { } }