using asap.core; using cfg; using Newtonsoft.Json; using System; using System.Collections.Generic; using UnityEngine; namespace Assets.Scripts.UI.OfferSweep { public class OfferSweepPackData { [JsonIgnore] private Tables _tables => GContext.container.Resolve(); [JsonIgnore] private EventPackManager PackManager => _tables.TbEventPackManager.GetOrDefault(SweepPackId); [JsonIgnore] public TimeSpan RemainingTime => FishingEventID > 0 && _tables.TbFishingEvent.DataMap.ContainsKey(FishingEventID) ? (DateTime.Parse((_tables.TbFishingEvent[FishingEventID]?.TimeDefinition as LimitedTime)?.EndTime) - ZZTimeHelper.UtcNow()) : default; [JsonIgnore] public bool IsActive => RemainingTime.TotalSeconds > 0 && SweepPackId > 0&&PurchasedCount /// index, packID /// public Dictionary PurchasePackDir = new Dictionary(); public void SetData(OfferSweepPackData data) { this.FishingEventID = data.FishingEventID; this.SweepPackId = data.SweepPackId; this.PurchasePackDir = data.PurchasePackDir; this.StartTimeVipLevel = data.StartTimeVipLevel; this.IsShowPoint = data.IsShowPoint; this.PurchasedCount = data.PurchasedCount; } } }