using System.Collections.Generic; using System.Diagnostics; using Assets.Scripts; using ChillConnect; using IgnoreOPS; using SGModule.DataStorage; 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 对象 if (messageKey == DataKeys.signState) { int a = 0; } 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.currency101, DataMsg.currency101); public static DataStorage Ticket = BindDataStorage(DataKeys.currency102, DataMsg.currency102); public static DataStorage MaxCurrency101 = BindDataStorage(DataKeys.maxCurrency101); 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 ResurrectionState = BindDataStorage(DataKeys.resurrectionState, null, 3); 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 AdCashFlyShowTime = BindDataStorage(DataKeys.adCashFlyShowTime); 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 AvailableDiceRolls = BindDataStorage(DataKeys.AvailableDiceRolls); public static DataStorage ArrowResultLevel = BindDataStorage(DataKeys.ArrowResultLevel,@default: 1); #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> ApplePayTransactionID = BindDataStorage(DataKeys.ApplePayTransactionID, @default: new List()); public static DataStorage> NewWatchCd = new(DataKeys.NewWatchCd,defaultValue: new List(),cloudSave: false); #endregion }