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