48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
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<Tables>();
|
|
[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<PackManager?.MaxCount;
|
|
|
|
public int FishingEventID;
|
|
|
|
public int SweepPackId;
|
|
|
|
public int StartTimeVipLevel;
|
|
|
|
public bool IsShowPoint = true;
|
|
|
|
public int PurchasedCount = 0;
|
|
/// <summary>
|
|
/// index, packID
|
|
/// </summary>
|
|
public Dictionary<int, int> PurchasePackDir = new Dictionary<int, int>();
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |