Files
taptap2024_GJ_chidouren/Assets/Scripts/System/Account/AccountSystemData.cs
2024-10-27 22:24:41 +08:00

113 lines
2.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Game.Account;
using System.Globalization;
using System.OfflineSystem;
using FJson;
using Framework.Save;
using Framework.Utils;
using Game.Data;
using Script.Core.Utils.Extend;
using UnityEngine;
public class AccountSystemData
{
public float BGMValue = 1f;
public float BSEValue = 0.5f;
public float SEValue = 0.8f;
public PeriodicityNumber AdShowCount; //每日可看广告次数
public OfflineTimeHandler PowerAdTimeHandler; //体力广告恢复倒计时
public long CreateTime;
public long CurrentTime => GameManager.Instance.CurrentTime;
public List<string> CompleteGuideTable; //已完成的引导table
public bool HasCompleteInitStory; //是否已经完成了初始化的引导
public bool HasCompleteRename; //是否已经完成了改名引导
public List<int> SystemMissionId; //系统任务id
public float ShakeValue = 1f; //游戏震动强度
/// <summary>
/// 账号创建截止当前时间
/// </summary>
public TimeSpan CreateTotalTimeSpan => TimeSpan.FromMilliseconds (this.CurrentTime - this.CreateTime);
public DateTime CurrentDateTime => this.CurrentTime.GetDateTime13 ();
public static DateTime PointTime = new DateTime (2023, 1, 1, 0, 0, 0);
public static DateTime StartTime = new DateTime (1970, 1, 1, 0, 0, 0);
public void NullCheck ()
{
if (this.AdShowCount == null)
{
this.AdShowCount = new PeriodicityNumber (GameGlobalConfig.Instance.EveryDayAdLimit);
}
if (CompleteGuideTable == null)
{
this.CompleteGuideTable = new List<string> ();
}
if (SystemMissionId == null)
{
SystemMissionId = new List<int> ();
}
}
public bool IsNull ()
{
return this.AdShowCount == null;
}
public void UpdateCurrentTime (long curTime = 0)
{
CheckCreateTime (curTime);
this.AdShowCount.CheckTime (this.CurrentDateTime, GameGlobalConfig.Instance.EveryDayAdLimit);
Account.Instance.Save (SaveData.System);
}
private void NewDay ()
{
}
public void CheckCreateTime (long curTime = 0)
{
if (this.CreateTime == 0)
{
this.CreateTime = curTime;
}
else
{
return;
}
DateTime temp = this.CreateTime.GetDateTime13 ();
//只精确到天
this.CreateTime = new DateTime (temp.Year, temp.Month , temp.Day).ToTimeStamp13 ();
Debug.Log ("User Create Time" + temp.ToShortDateString ());
Account.Instance.Save (SaveData.System);
}
public void AddVideoAdCount ()
{
this.AdShowCount.Write (this.AdShowCount.Read - 1);
Account.Instance.Save (SaveData.System);
}
}