35 lines
867 B
C#
Raw Normal View History

2026-05-06 15:07:56 +02:00
using UnityEngine;
namespace DuloGames.UI
{
public class Test_UIItemSlot_AssignAll : MonoBehaviour
{
[SerializeField] private Transform m_Container;
void Start()
{
if (this.m_Container == null || UIItemDatabase.Instance == null)
{
this.Destruct();
return;
}
UIItemSlot[] slots = this.m_Container.gameObject.GetComponentsInChildren<UIItemSlot>();
UIItemInfo[] items = UIItemDatabase.Instance.items;
if (slots.Length > 0 && items.Length > 0)
{
foreach (UIItemSlot slot in slots)
slot.Assign(items[Random.Range(0, items.Length)]);
}
this.Destruct();
}
private void Destruct()
{
DestroyImmediate(this);
}
}
}