Files
JJBB/Assets/Project/Script/GUI/Childs/ChildAdventureRecordPanel.cs
2024-08-23 15:49:34 +08:00

57 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ChildAdventureRecordPanel : MonoBehaviour {
public static ChildAdventureRecordPanel Instance;
private void Awake()
{
Instance = this;
}
private void OnDestroy()
{
Instance = null;
}
public UIContainerBase _ItemContainer;
private int _CurSelectChildIndex = -1;
List<ChildEventRD> _list;
public void InitRecordPanel(int childIndex)
{
_CurSelectChildIndex = childIndex;
_ItemContainer.InitContentItem(null);
ReqChildRecord();
}
void ReqChildRecord()
{
ReqChildEventRD req = new ReqChildEventRD();
req.childGuid = ChildData.GetChildByIndex(_CurSelectChildIndex).guid;
req.SendMsg();
}
public void OnPacket(RetChildEventRD packet)
{
if (packet.eventRecordList.Count < 1)
{
_ItemContainer.InitContentItem(null);
return;
}
_list = new List<ChildEventRD>();
for (int index = 0; index < packet.eventRecordList.Count; index++)
{
_list.Add(packet.eventRecordList[index]);
}
_ItemContainer.InitContentItem(_list);
}
public void OnMask()
{
gameObject.SetActive(false);
}
}