NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Raffle/RaffleData.cs

91 lines
2.0 KiB
C#
Raw Normal View History

2023-12-27 19:45:21 +08:00
using cfg.ActorCfg;
2024-12-09 19:27:56 +08:00
using cfg.RedPoint;
2025-03-26 14:05:26 +08:00
using Cysharp.Threading.Tasks.Triggers;
2023-12-27 19:45:21 +08:00
using Gameplay.Net;
2024-06-27 16:18:37 +08:00
using System.Collections.Generic;
2023-12-27 19:45:21 +08:00
2024-12-09 17:11:11 +08:00
/// <summary>
/// 卡池数据
/// </summary>
2025-03-26 14:05:26 +08:00
public sealed class RaffleData : IRedPointTreeNode
2023-12-27 19:45:21 +08:00
{
2024-06-26 19:37:49 +08:00
#region 属性
2024-03-19 16:57:10 +08:00
/// <summary>
/// 卡池配置数据
/// </summary>
2024-06-26 19:37:49 +08:00
public DataGacha Cfg { get; private set; }
2024-03-19 16:57:10 +08:00
/// <summary>
/// 卡池累计抽取数据
/// </summary>
2024-12-09 17:11:11 +08:00
public RaffleCount ServerData { get; private set; }
2024-03-19 16:57:10 +08:00
2024-12-09 19:27:56 +08:00
/// <summary>
/// 红点
/// </summary>
public RedPointNode RedPoint { get; private set; }
2024-03-19 16:57:10 +08:00
/// <summary>
2024-12-09 17:11:11 +08:00
/// 有可以抽取的
2024-03-19 16:57:10 +08:00
/// </summary>
2025-03-26 14:05:26 +08:00
public bool CanRaffle
2024-06-27 16:18:37 +08:00
{
2024-12-09 19:27:56 +08:00
get
2024-06-28 14:02:15 +08:00
{
2025-03-26 14:05:26 +08:00
for (int i = 0; i < RaffleButtonDatas.Length; ++i)
2024-06-28 14:02:15 +08:00
{
2025-03-26 14:05:26 +08:00
if (RaffleButtonDatas[i].IsRaffle)
2024-06-28 14:02:15 +08:00
return true;
}
return false;
}
2024-06-27 16:18:37 +08:00
}
2024-03-19 16:57:10 +08:00
2025-04-03 16:35:09 +08:00
/// <summary>
/// 是否开启
/// </summary>
public bool IsOpen
{
get{ return true; } // TODO 等待活动
}
2024-03-19 16:57:10 +08:00
/// <summary>
2025-03-26 14:05:26 +08:00
/// 抽卡按钮数组
2024-03-19 16:57:10 +08:00
/// </summary>
2025-03-26 14:05:26 +08:00
public RaffleButtonData[] RaffleButtonDatas { get; private set; }
2024-06-26 19:37:49 +08:00
#endregion
2025-03-26 14:05:26 +08:00
public RaffleData(DataGacha cfg)
2023-12-27 19:45:21 +08:00
{
2024-06-26 19:37:49 +08:00
Cfg = cfg;
2025-03-26 14:05:26 +08:00
RaffleButtonDatas = new RaffleButtonData[RaffleManager.RAFFLE_BUTTON_COUNT];
2024-06-27 16:18:37 +08:00
2024-12-09 19:27:56 +08:00
ConstructRedPointTree(50);
2024-03-19 19:09:13 +08:00
}
public void Refresh()
{
2024-12-09 17:11:11 +08:00
ServerData = Actor.Instance.Raffle.GetRaffleInfo((uint)Cfg.Id);
2024-06-26 19:37:49 +08:00
2025-03-26 14:51:26 +08:00
for (int i = 0; i < Cfg.BtnDisplay.Length && i < RaffleManager.RAFFLE_BUTTON_COUNT; ++i)
2024-06-26 19:37:49 +08:00
{
2025-03-26 14:05:26 +08:00
RaffleButtonDatas[i] = new RaffleButtonData()
2024-06-26 19:37:49 +08:00
{
2025-03-26 14:05:26 +08:00
Cfg = Cfg,
2025-03-26 14:51:26 +08:00
Count = Cfg.BtnDisplay[i],
ServerData = ServerData,
2025-03-26 14:05:26 +08:00
};
2024-06-26 19:37:49 +08:00
}
2023-12-27 19:45:21 +08:00
}
2024-12-09 19:27:56 +08:00
public void ConstructRedPointTree(int parentID)
{
RedPoint = RedPointManager.Instance.AddDynamicNode(NodeType.Raffle, parentID, Cfg.Id);
}
public void ConstructRedPointTree(RedPointNode parent)
{
}
2024-03-19 16:57:10 +08:00
}