83 lines
1.9 KiB
C#
83 lines
1.9 KiB
C#
using cfg.ActorCfg;
|
|
using cfg.RedPoint;
|
|
using Cysharp.Threading.Tasks.Triggers;
|
|
using Gameplay.Net;
|
|
using System.Collections.Generic;
|
|
|
|
/// <summary>
|
|
/// 卡池数据
|
|
/// </summary>
|
|
public sealed class RaffleData : IRedPointTreeNode
|
|
{
|
|
#region 属性
|
|
/// <summary>
|
|
/// 卡池配置数据
|
|
/// </summary>
|
|
public DataGacha Cfg { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 卡池累计抽取数据
|
|
/// </summary>
|
|
public RaffleCount ServerData { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 红点
|
|
/// </summary>
|
|
public RedPointNode RedPoint { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 有可以抽取的
|
|
/// </summary>
|
|
public bool CanRaffle
|
|
{
|
|
get
|
|
{
|
|
for (int i = 0; i < RaffleButtonDatas.Length; ++i)
|
|
{
|
|
if (RaffleButtonDatas[i].IsRaffle)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 抽卡按钮数组
|
|
/// </summary>
|
|
public RaffleButtonData[] RaffleButtonDatas { get; private set; }
|
|
#endregion
|
|
|
|
public RaffleData(DataGacha cfg)
|
|
{
|
|
Cfg = cfg;
|
|
RaffleButtonDatas = new RaffleButtonData[RaffleManager.RAFFLE_BUTTON_COUNT];
|
|
|
|
ConstructRedPointTree(50);
|
|
}
|
|
|
|
public void Refresh()
|
|
{
|
|
ServerData = Actor.Instance.Raffle.GetRaffleInfo((uint)Cfg.Id);
|
|
|
|
for (int i = 0; i < Cfg.BtnDisplay.Length && i < RaffleManager.RAFFLE_BUTTON_COUNT; ++i)
|
|
{
|
|
RaffleButtonDatas[i] = new RaffleButtonData()
|
|
{
|
|
Cfg = Cfg,
|
|
Count = Cfg.BtnDisplay[i],
|
|
ServerData = ServerData,
|
|
};
|
|
}
|
|
}
|
|
|
|
public void ConstructRedPointTree(int parentID)
|
|
{
|
|
RedPoint = RedPointManager.Instance.AddDynamicNode(NodeType.Raffle, parentID, Cfg.Id);
|
|
}
|
|
|
|
public void ConstructRedPointTree(RedPointNode parent)
|
|
{
|
|
|
|
}
|
|
} |