using cfg.ActorCfg;
using Gameplay.Net;
///
/// 抽卡按钮数据
///
public struct RaffleButtonData
{
///
/// 配置
///
public DataGacha Cfg;
///
/// 抽卡次数
///
public int Count;
///
/// 服务器数据
///
public RaffleCount ServerData;
///
/// 消耗的货币id
///
public readonly int CostId { get { return Cfg.SingleCost.Id; } }
///
/// 单次抽取消耗的货币数量
///
public readonly int SingleCost { get { return Cfg.SingleCost.Count; } }
///
/// 能否抽取
///
public readonly bool IsRaffle
{
get
{
if (null == Cfg)
return false;
if (IsFreeOne)
return true;
int needCount = Count - (int)CategoryManager.Instance.GetItemCount(Cfg.TicketItemID); // 需要用货币补足的数目
if (needCount <= 0)
return true;
return (int)CategoryManager.Instance.GetItemCount(CostId) >= needCount * SingleCost;
}
}
///
/// 是否只用抽卡券就能抽取
///
public readonly bool IsTicketRaffle { get { return CategoryManager.Instance.GetItemCount(Cfg.TicketItemID) >= Count; } }
///
/// 是否可以免费单抽
///
public readonly bool IsFreeOne
{
get
{
if (1 != Count)
return false;
if (null == ServerData)
return Cfg.DailyFreeCount > 0;
return Cfg.DailyFreeCount > ServerData.FreeCount;
}
}
}