备份CatanBuilding瘦身独立工程
This commit is contained in:
28
Assets/Scripts/UI/Shop/GiftRewardAttached.cs
Normal file
28
Assets/Scripts/UI/Shop/GiftRewardAttached.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user