2024-11-13 16:56:37 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class SlotUI : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private int index;
|
|
|
|
|
|
|
|
[SerializeField] private Image icon;
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SaveIndex()
|
|
|
|
{
|
|
|
|
GameSystem.ins.SaveIndex(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ResetIcon()
|
|
|
|
{
|
|
|
|
if (GameSystem.ins.drawingManager.itemsSlot[index]!=0)
|
|
|
|
{
|
|
|
|
icon.gameObject.SetActive(true);
|
2024-12-11 13:58:55 +08:00
|
|
|
var data=JsonTab.Instance.tables.Item.Get(GameSystem.ins.drawingManager.itemsSlot[index]);
|
|
|
|
icon.sprite = AssetBundleManager.ins.Sprite(data.Icon,AtlasType.ItemIcon);
|
2024-11-13 16:56:37 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
icon.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|