feat:1、创建项目
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
public static partial class DataKeys
|
||||
{
|
||||
public const string UserID = "UserID";
|
||||
public const string FirstLogin = "FirstLogin";
|
||||
public const string currency101 = "currency101";
|
||||
public const string currency102 = "currency102";
|
||||
public const string maxCurrency101 = "maxCurrency101";
|
||||
public const string nextOpenWheelStampTime = "nextOpenWheelStampTime";
|
||||
public const string thisDayWatchSlyderVideoNum = "thisDayWatchSlyderVideoNum";
|
||||
public const string playerName = "playerName";
|
||||
public const string playerAvatarId = "playerAvatarId";
|
||||
public const string signState = "signState";
|
||||
public const string gameOfCount = "gameOfCount";
|
||||
public const string gameLevel = "gameLevel";
|
||||
public const string resurrectionState = "resurrectionState"; //复活状态:4种,数字3为可以用广告和金币复活,2为只能用广告,1为只能用金币。0为不能复活
|
||||
|
||||
public const string exchangeAccount = "exchangeAccount";
|
||||
public const string exchangeName = "exchangeName";
|
||||
public const string isShowRewardFly101 = "isShowRewardFly101";
|
||||
public const string isShowRewardFly102 = "isShowRewardFly102";
|
||||
public const string playReawrd111 = "playReawrd111";
|
||||
public const string isShowRewardFly111 = "isShowRewardFly111";
|
||||
public const string isShowOpenReward = "isShowOpenReward";
|
||||
public const string isLastH5Tab = "isLastH5Tab";
|
||||
public const string adCashFlyShowTime = "adCashFlyShowTime";
|
||||
public const string h5StayTime = "h5StayTime";
|
||||
public const string videoWatchCount = "videoWatchCount";
|
||||
public const string makeupTaskHistory = "makeupTaskHistory";
|
||||
public const string makeupTaskH5Time = "makeupTaskH5Time";
|
||||
public const string gameStartCount = "gameStartCount";
|
||||
public const string loginGameTodayTimes = "loginGameTodayTimes";
|
||||
public const string date = "date";
|
||||
public const string ch_level = "ch_level";
|
||||
public const string SaveObject = "SaveObject";
|
||||
public const string LevelData = "LevelData";
|
||||
public const string AvailableDiceRolls = "AvailableDiceRolls"; // 可摇骰子次数
|
||||
public const string RankData = "RankData";
|
||||
public const string ApplePayTransactionID = "ApplePayTransactionID"; //ios购买后的非消耗性订单id
|
||||
public const string NewWatchCd = "NewWatchCd";
|
||||
public const string ArrowResultLevel = "ArrowResultLevel"; //箭头游戏的结算等级(1:免费,0:看广告)
|
||||
public const string ArrowDarkTheme = "ArrowDarkTheme"; //箭头游戏的黑夜模式(0:黑夜,1:白天)
|
||||
public const string ArrowTheme = "ArrowTheme"; //箭头游戏的主题(0:黑色 1:虫子 2:彩色)
|
||||
public const string ArrowChProgress = "ArrowChProgress"; //箭头cash 进度
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c59f64be7ea460a44bddc190831fbbcb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
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<T> BindDataStorage<T>(string key, string messageKey = null, T @default = default)
|
||||
{
|
||||
return new DataStorage<T>(key, @default, (oldValue, newValue) =>
|
||||
{
|
||||
// 构造 ChangeValue 对象
|
||||
if (messageKey == DataKeys.signState)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
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.currency101, DataMsg.currency101);
|
||||
public static DataStorage<decimal> Ticket = BindDataStorage<decimal>(DataKeys.currency102, DataMsg.currency102);
|
||||
public static DataStorage<int> MaxCurrency101 = BindDataStorage<int>(DataKeys.maxCurrency101);
|
||||
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<int> ResurrectionState = BindDataStorage<int>(DataKeys.resurrectionState, null, 3);
|
||||
|
||||
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> AdCashFlyShowTime = BindDataStorage<long>(DataKeys.adCashFlyShowTime);
|
||||
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> AvailableDiceRolls = BindDataStorage<int>(DataKeys.AvailableDiceRolls);
|
||||
public static DataStorage<int> ArrowResultLevel = BindDataStorage<int>(DataKeys.ArrowResultLevel,@default: 1);
|
||||
public static DataStorage<int> ArrowDarkTheme = BindDataStorage<int>(DataKeys.ArrowDarkTheme,@default: 1);
|
||||
public static DataStorage<int> ArrowTheme = BindDataStorage<int>(DataKeys.ArrowTheme,@default: 0);
|
||||
public static DataStorage<int> ArrowChProgress = BindDataStorage<int>(DataKeys.ArrowChProgress,@default: 0);
|
||||
|
||||
|
||||
#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<string>> ApplePayTransactionID = BindDataStorage(DataKeys.ApplePayTransactionID, @default: new List<string>());
|
||||
public static DataStorage<List<int>> NewWatchCd = new(DataKeys.NewWatchCd,defaultValue: new List<int>(),cloudSave: false);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5151422b80f61e4992ae51ac0b87787
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
public static class DataMsg {
|
||||
public const string currency101 = "Preferences_currency101";
|
||||
public const string currency102 = "Preferences_currency102";
|
||||
public const string playerName = "Preferences_playerName";
|
||||
public const string playerAvatarId = "Preferences_playerAvatarId";
|
||||
public const string isShowRewardFly101 = "Preferences_isShowRewardFly101";
|
||||
public const string playReawrd111 = "Preferences_playReawrd111";
|
||||
public const string isShowRewardFly111 = "Preferences_isShowRewardFly111";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b104d17b32ee2404dadd6573d3d26ef5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Collections.Generic;
|
||||
using ChillConnect;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace Assets.Scripts {
|
||||
public class PreferencesDataReadyCtrl : BaseCtrl {
|
||||
private readonly List<uint> msgList = new();
|
||||
|
||||
|
||||
public void PreferenceDataReady(object objs = null) {
|
||||
InspectionNewDay();
|
||||
|
||||
|
||||
DataMgr.GameStartCount.Value++;
|
||||
}
|
||||
|
||||
|
||||
public void InspectionNewDay() {
|
||||
var login_time = LoginKit.Instance.LoginModel.LoginTime;
|
||||
var data = DateTimeManager.Instance.GetDateTime(login_time);
|
||||
var dateStr = DateTimeManager.Instance.DateTimeToYYYYMMDD(data);
|
||||
if (!DataMgr.Date.Value.Equals(dateStr)) {
|
||||
DataMgr.Date.Value = dateStr;
|
||||
msgList.Add(CtrlMsg.NewDays);
|
||||
DataMgr.LoginGameTodayTimes.Value = 1;
|
||||
}
|
||||
else {
|
||||
DataMgr.LoginGameTodayTimes.Value++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SendCtrlMsg(object args = null) {
|
||||
for (var i = 0; i < msgList.Count; i++) {
|
||||
ctrlDispatcher.Dispatch(msgList[i]);
|
||||
}
|
||||
|
||||
msgList.Clear();
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit() {
|
||||
}
|
||||
|
||||
protected override void OnDispose() {
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
protected override void AddListener() {
|
||||
ctrlDispatcher.AddListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
|
||||
ctrlDispatcher.AddListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
|
||||
}
|
||||
|
||||
protected override void RemoveListener() {
|
||||
ctrlDispatcher.RemoveListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
|
||||
ctrlDispatcher.RemoveListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae6043f24584f694ba73b736ad18bb6d
|
||||
timeCreated: 1692007381
|
||||
Reference in New Issue
Block a user