Files
BallCrushBest_GP/Assets/Scripts/DataMgr/DataMgr.cs
T
2026-04-20 12:06:34 +08:00

116 lines
8.5 KiB
C#

using System.Collections.Generic;
using IgnoreOPS;
using SGModule.DataStorage;
using BallKingdomCrush;
public static partial class DataMgr
{
public static string long_name;
public static string short_name;
private static DataStorage<T> BindDataStorage<T>(string key, string messageKey = null, T @default = default)
{
return new DataStorage<T>(key, @default, (oldValue, newValue) =>
{
// 构造 ChangeValue 对象
var changeValue = new ChangeValue<T>
{
oldValue = oldValue,
newValue = newValue
};
if (messageKey.IsNullOrWhiteSpace())
{
return;
}
// 调用特定类型的分发器
PreferencesDispatcher<T>.Instance.Dispatch(messageKey, changeValue);
// 调用全局数据分发器(如果需要)
DataDispatcher.Instance.Dispatch(messageKey);
});
}
#region ValueType
public static DataStorage<bool> FirstLogin = new(DataKeys.FirstLogin, true);
public static DataStorage<long> UserID = BindDataStorage(DataKeys.UserID, @default: -1L);
public static DataStorage<long> NextOpenWheelStampTime = BindDataStorage<long>(DataKeys.nextOpenWheelStampTime);
public static DataStorage<int> ThisDayWatchSlyderVideoNum = BindDataStorage<int>(DataKeys.thisDayWatchSlyderVideoNum);
public static DataStorage<int> Coin = BindDataStorage<int>(DataKeys.coin, DataMsg.currency101);
public static DataStorage<decimal> Ticket = BindDataStorage<decimal>(DataKeys.ticket, DataMsg.currency102);
public static DataStorage<int> MaxCurrency101 = BindDataStorage<int>(DataKeys.maxCoin);
public static DataStorage<string> PlayerName = BindDataStorage<string>(DataKeys.playerName, DataMsg.playerName);
public static DataStorage<int> PlayerAvatarId = BindDataStorage<int>(DataKeys.playerAvatarId, DataMsg.playerAvatarId);
public static DataStorage<int> GameOfCount = BindDataStorage<int>(DataKeys.gameOfCount);
public static DataStorage<int> GameLevel = BindDataStorage(DataKeys.gameLevel, @default: 1);
public static DataStorage<string> ExchangeAccount = BindDataStorage<string>(DataKeys.exchangeAccount);
public static DataStorage<string> ExchangeName = BindDataStorage<string>(DataKeys.exchangeName);
public static DataStorage<bool> IsShowRewardFly101 = BindDataStorage<bool>(DataKeys.isShowRewardFly101, DataMsg.isShowRewardFly101);
public static DataStorage<bool> IsShowRewardFly102 = BindDataStorage<bool>(DataKeys.isShowRewardFly102);
public static DataStorage<decimal> PlayReawrd111 = BindDataStorage<decimal>(DataKeys.playReawrd111, DataMsg.playReawrd111);
public static DataStorage<bool> IsShowRewardFly111 = BindDataStorage<bool>(DataKeys.isShowRewardFly111, DataMsg.isShowRewardFly111);
public static DataStorage<bool> IsShowOpenReward = BindDataStorage<bool>(DataKeys.isShowOpenReward);
public static DataStorage<bool> IsLastH5Tab = BindDataStorage<bool>(DataKeys.isLastH5Tab);
public static DataStorage<long> AdChFlyShowTime = BindDataStorage<long>(DataKeys.adChFlyShowTime);
public static DataStorage<int> H5StayTime = BindDataStorage<int>(DataKeys.h5StayTime);
public static DataStorage<int> VideoWatchCount = BindDataStorage<int>(DataKeys.videoWatchCount);
public static DataStorage<decimal> MakeupTaskH5Time = BindDataStorage<decimal>(DataKeys.makeupTaskH5Time);
public static DataStorage<int> GameStartCount = BindDataStorage<int>(DataKeys.gameStartCount);
public static DataStorage<int> LoginGameTodayTimes = BindDataStorage<int>(DataKeys.loginGameTodayTimes);
public static DataStorage<string> Date = BindDataStorage<string>(DataKeys.date);
public static DataStorage<int> ChLevel = BindDataStorage<int>(DataKeys.ch_level);
public static DataStorage<string> LevelData = new(DataKeys.LevelData, cloudSave: false);
public static DataStorage<int> AdWatchCount = BindDataStorage<int>(DataKeys.AdWatchCount);
public static DataStorage<int> AvailableDiceRolls = BindDataStorage<int>(DataKeys.AvailableDiceRolls);
public static DataStorage<int> PropBackNum = BindDataStorage<int>(DataKeys.propBackNum);
public static DataStorage<int> PropRefreshNum = BindDataStorage<int>(DataKeys.propRefreshNum);
public static DataStorage<int> PropRemoveNum = BindDataStorage<int>(DataKeys.propRemoveNum);
public static DataStorage<int> ResurrectionState = BindDataStorage<int>(DataKeys.resurrectionState, null, 3);
public static DataStorage<int> GameExperience = BindDataStorage<int>(DataKeys.gameExperience);
public static DataStorage<bool> GetFirstReaward = BindDataStorage<bool>(DataKeys.getFirstReaward);
public static DataStorage<bool> NoviceGuide = BindDataStorage<bool>(DataKeys.noviceGuide);
public static DataStorage<int> GameTime = BindDataStorage<int>(DataKeys.gameTime);
public static DataStorage<int> GameDay = BindDataStorage<int>(DataKeys.gameDay);
public static DataStorage<int> IsUnlockSecret = BindDataStorage<int>(DataKeys.IsUnlockSecret, null, -1);
public static DataStorage<int> VipLevel = BindDataStorage<int>(DataKeys.VipLevel, null, -1);
public static DataStorage<long> VipExpirationTime = BindDataStorage<long>(DataKeys.VipExpirationTime);
// public static DataStorage<string> VipTransactionID = BindDataStorage<string>(DataKeys.VipTransactionID,null,"");
public static DataStorage<int> IsUnlockLive = BindDataStorage<int>(DataKeys.IsUnlockLive, null, -1);
public static DataStorage<int> VipRequestNum = BindDataStorage<int>(DataKeys.VipRequestNum);
#endregion
#region RefType
public static DataStorage<List<long>> SignState = BindDataStorage(DataKeys.signState, @default: new List<long>());
public static DataStorage<List<MakeupTaskData>> MakeupTaskHistory = BindDataStorage(DataKeys.makeupTaskHistory, @default: new List<MakeupTaskData>());
public static DataStorage<Saveobject> SaveObject = BindDataStorage(DataKeys.SaveObject, @default: new Saveobject());
public static DataStorage<List<int>> SecretUnlockList = BindDataStorage(DataKeys.SecretUnlockList, @default: new List<int>());
public static DataStorage<List<string>> ApplePayTransactionID = BindDataStorage(DataKeys.ApplePayTransactionID, @default: new List<string>());
public static DataStorage<Dictionary<int, int>> SecretUnlockCd = new(DataKeys.SecretUnlockCd, defaultValue: new Dictionary<int, int>(), cloudSave: false);
public static DataStorage<Dictionary<int, int>> SecretUnlockADs = new(DataKeys.SecretUnlockADs, defaultValue: new Dictionary<int, int>());
public static DataStorage<Dictionary<int, int>> LiveUnlockCd = new(DataKeys.LiveUnlockCd, defaultValue: new Dictionary<int, int>(), cloudSave: false);
// public static DataStorage<List<LiveData>> LiveDataList = new(DataKeys.LiveDataList, defaultValue: new List<LiveData>());
// public static DataStorage<Dictionary<int, LiveData>> LiveDataList = new(DataKeys.LiveDataList, defaultValue: new List<LiveData>());
public static DataStorage<Dictionary<int, LiveData>> LiveDataDic = new(DataKeys.LiveDataDic, defaultValue: new Dictionary<int, LiveData>());
public static DataStorage<List<int>> LevelUnlockList = new(DataKeys.LevelUnlockList, defaultValue: new List<int>());
public static DataStorage<int> IsUnlockChat = BindDataStorage<int>(DataKeys.IsUnlockChat, null, -1);
public static DataStorage<List<ChatItem>> ChatData = new(DataKeys.ChatData, cloudSave: false);
public static DataStorage<int> ChatNumber = BindDataStorage<int>(DataKeys.ChatNumber, null, 0);
public static DataStorage<int> ChatFreeNumber = BindDataStorage<int>(DataKeys.ChatFreeNumber, null, 0);
public static DataStorage<int> ChatRecoverDays = BindDataStorage<int>(DataKeys.ChatRecoverDays, null, -1);
public static DataStorage<string> curResVersion = new(DataKeys.curResVersion, cloudSave: false);
public static DataStorage<List<Levelunlock>> LevelUnlockListNew = new(DataKeys.LevelUnlockListNew, defaultValue: new List<Levelunlock>());
public static DataStorage<int> LevelUnlockFree = new(DataKeys.LevelUnlockListFree, defaultValue: -1);
public static DataStorage<int> LevelUnlockAD = new(DataKeys.LevelUnlockListAD, defaultValue: -1);
public static DataStorage<int> LevelUnlockSpecial = new(DataKeys.LevelUnlockListSpecial, defaultValue: -1);
public static DataStorage<int> LevelUnlockVIP = new(DataKeys.LevelUnlockListVIP, defaultValue: -1);
public static DataStorage<int> selectLanguage = BindDataStorage<int>(DataKeys.selectLanguage, null, -1);
#endregion
}