68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using Framework;
|
|
using PhxhSDK;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 卡池数据管理器
|
|
/// </summary>
|
|
public class DrawInfoManager : Singlenton<DrawInfoManager>, IInitable
|
|
{
|
|
/// <summary>
|
|
/// 卡池数据列表
|
|
/// </summary>
|
|
private List<DrawInfo> listAllDrawInfo;
|
|
private List<DrawInfo> listShowDrawInfo;
|
|
|
|
public void Init()
|
|
{
|
|
listAllDrawInfo = new List<DrawInfo>();
|
|
listShowDrawInfo = new List<DrawInfo>();
|
|
|
|
EventManager.Instance.Register(EventManager.EventName.AllConfigLoad, LoadDrawData);
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
EventManager.Instance.Unregister(EventManager.EventName.AllConfigLoad, LoadDrawData);
|
|
|
|
if (null != listShowDrawInfo)
|
|
{
|
|
listShowDrawInfo.Clear();
|
|
listShowDrawInfo = null;
|
|
}
|
|
|
|
if (null != listAllDrawInfo)
|
|
{
|
|
listAllDrawInfo.Clear();
|
|
listAllDrawInfo = null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载卡池数据
|
|
/// </summary>
|
|
private void LoadDrawData()
|
|
{
|
|
for (int i = 0; i < TableManager.Instance.Tables.Gacha.DataList.Count; i++)
|
|
{
|
|
listAllDrawInfo.Add(new DrawInfo(TableManager.Instance.Tables.Gacha.DataList[i]));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 刷新数据
|
|
/// </summary>
|
|
private void RefreshData()
|
|
{
|
|
listShowDrawInfo.Clear();
|
|
foreach (DrawInfo rafflePoolForDisplay in listAllDrawInfo)
|
|
{
|
|
rafflePoolForDisplay.Refresh();
|
|
if (rafflePoolForDisplay.IsDraw)
|
|
listShowDrawInfo.Add(rafflePoolForDisplay);
|
|
}
|
|
}
|
|
}
|