로직 데이터 연동 시작
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,14 @@ public class UIButtonToggle : MonoBehaviour
|
||||
});
|
||||
}
|
||||
}
|
||||
public void OnPressed()
|
||||
{
|
||||
onPressed?.Invoke();
|
||||
isPressed = true;
|
||||
}
|
||||
public void OnReleased()
|
||||
{
|
||||
onReleased?.Invoke();
|
||||
isPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user