Files
ft/Client/Assets/Scripts/EventBoostPack/Data/EventBoostPackData.cs
2026-06-29 21:18:33 +08:00

31 lines
861 B
C#

using Activity;
using cfg;
using Newtonsoft.Json;
using asap.core;
using GameCore;
using System;
namespace EventBoostPack.Data
{
public class EventBoostPackData : AEventData
{
[JsonIgnore]
public EventPackManager PackConfig =>
Tables.TbEventPackManager.GetOrDefault(FishingEvent?.RedirectID ?? 0);
[JsonIgnore]
public override bool IsActive => EventID > 0 && RemainingTime.TotalSeconds > 0 && GetRemainingBuyCount() > 0;
public string GetDailyBuyCountKey()
{
return $"EventBoostPack_{EventID}";
}
public int GetRemainingBuyCount()
{
var maxCount = PackConfig?.MaxCount ?? 0;
return Math.Max(0, maxCount - GContext.container.Resolve<PlayerShopData>()
.GetShopPackBuyCount(GetDailyBuyCountKey()));
}
}
}