备份CatanBuilding瘦身独立工程
This commit is contained in:
37
Assets/Scripts/UI/Albun/ExchangePictureItemGroup.cs
Normal file
37
Assets/Scripts/UI/Albun/ExchangePictureItemGroup.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ExchangePictureItemGroup : PanelItemBase<ExchangePictureItemGroupData>
|
||||
{
|
||||
List<ExchangePictureItem> pictureItems = new List<ExchangePictureItem>();
|
||||
private void Awake()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
GameObject go = transform.Find($"album_photo{i}").gameObject;
|
||||
pictureItems.Add(go.AddComponent<ExchangePictureItem>());
|
||||
}
|
||||
}
|
||||
public override void OnInit()
|
||||
{
|
||||
int count = data.exchangePictureItemDatas.Count;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (i < count)
|
||||
{
|
||||
pictureItems[i].gameObject.SetActive(true);
|
||||
pictureItems[i].SetData(data.exchangePictureItemDatas[i], data.action);
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureItems[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public class ExchangePictureItemGroupData
|
||||
{
|
||||
public List<ExchangePictureItemData> exchangePictureItemDatas = new List<ExchangePictureItemData>();
|
||||
public Action<ExchangePictureItem> action;
|
||||
}
|
||||
Reference in New Issue
Block a user