Files
ft/Client/Assets/Scripts/UI/AdWheel/AdWheelData.cs
2026-06-29 21:18:33 +08:00

62 lines
2.0 KiB
C#

using cfg;
using Newtonsoft.Json;
using System;
using System.Linq;
namespace Assets.Scripts.UI.AdWheel
{
public class AdWheelData
{
public AdWheelData(Tables tables = null)
{
if (tables != null) Tables = tables;
}
#region json ignore
[JsonIgnore]
public readonly Tables Tables;
[JsonIgnore]
public FishingEvent EventConfig => Tables.TbFishingEvent.GetOrDefault(EventID);
[JsonIgnore]
public TimeSpan RemainingTime => WeeklyEndEventTime - ZZTimeHelper.UtcNow().UtcNowOffset();
[JsonIgnore]
public bool IsActive => EventID > 0 && WeeklyEndEventTime > ZZTimeHelper.UtcNow().UtcNowOffset();
[JsonIgnore]
public DateTime WeeklyEndEventTime => DateTimeOffset.FromUnixTimeSeconds(EventRefreshTimeSeconds).DateTime;
[JsonIgnore]
public float Progerss => (float)Count /
(EventConfig.RedirectID <= 0 ?
1 : AdWheelMain?.ProgressRewardADTimeList.LastOrDefault() ?? 1);
[JsonIgnore]
public EventAdWheelMain AdWheelMain=>Tables.TbEventAdWheelMain.GetOrDefault(EventConfig?.RedirectID??0);
#endregion
public int EventID;
public long ActiveEventTime;
/// <summary>
/// AdWheelInit.ProgressRewardADTimeList
/// </summary>
public int Count;
public int ProgressRewardADTime;
public long lastViewAdTime;
public long EventRefreshTimeSeconds;
public void ClearProgress()
{
Count = 0;
ProgressRewardADTime = 0;
}
public void SetData(AdWheelData data)
{
this.lastViewAdTime= data.lastViewAdTime;
this.ActiveEventTime = data.ActiveEventTime;
this.Count = data.Count;
this.EventID = data.EventID;
this.ProgressRewardADTime = data.ProgressRewardADTime;
this.EventRefreshTimeSeconds=data.EventRefreshTimeSeconds;
}
}
}