로직 데이터 연동 시작

This commit is contained in:
SullyunShin
2025-05-26 18:06:25 +09:00
parent c06a65ad49
commit 1eea6538a3
46 changed files with 5577 additions and 1433 deletions

View File

@@ -1,20 +1,46 @@
using UnityEngine;
using System.Collections.Generic;
using TMPro;
using UnityEngine.UI;
public class UIBottomInventory : MonoBehaviour
{
public List<GameObject> inventory = new List<GameObject>();
public Transform context;
public Transform content;
public TMP_Text text;
Image img;
private void Awake()
{
img = GetComponent<Image>();
}
public void LoadInventory()
{
for (int i = 0; i < context.childCount; i++)
for (int i = 0; i < content.childCount; i++)
{
GameObject obj = context.GetChild(i).gameObject;
GameObject obj = content.GetChild(i).gameObject;
Destroy(obj);
}
for (int i = 0; i < inventory.Count; i++)
{
GameObject prefab = inventory[i];
Instantiate(prefab, context);
Instantiate(prefab, content);
}
}
public void RemoveInventory()
{
for (int i = 0; i < content.childCount; i++)
{
GameObject obj = content.GetChild(i).gameObject;
Destroy(obj);
}
}
public void OnSelect()
{
img.color = Color.red;
text.color = Color.white;
}
public void OnDeselect()
{
img.color = Color.white;
text.color = Color.black;
}
}

View File

@@ -21,4 +21,14 @@ public class UIButtonToggle : MonoBehaviour
});
}
}
public void OnPressed()
{
onPressed?.Invoke();
isPressed = true;
}
public void OnReleased()
{
onReleased?.Invoke();
isPressed = false;
}
}