29 lines
738 B
C#
29 lines
738 B
C#
using GameCore;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class GiftRewardAttached : MonoBehaviour
|
|
{
|
|
public GameObject[] gift;
|
|
private void Reset()
|
|
{
|
|
int count = transform.childCount - 1;
|
|
gift = new GameObject[count];
|
|
for (int i = 0; i < gift.Length; i++)
|
|
{
|
|
gift[i] = transform.Find("gift" + (i + 1)).gameObject;
|
|
}
|
|
}
|
|
public void SetData(List<ItemData> itemDatas)
|
|
{
|
|
for (int i = 0; i < gift.Length; i++)
|
|
{
|
|
gift[i].SetActive(i < itemDatas.Count);
|
|
if (i < itemDatas.Count)
|
|
{
|
|
gift[i].GetComponentInChildren<RewardItemNew>().SetData(itemDatas[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|