38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
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;
|
|
}
|