feat:1、添加项目
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using SGModule.Common.Helper;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace BallKingdomCrush {
|
||||
public class CloudDataSaver {
|
||||
public static void UpdateData(string json, long version, bool onQuit) {
|
||||
Log.Info("CloudDataSaver", $"最新数据版本: {version}, onQuit: {onQuit} ,数据: {json}");
|
||||
if (json == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 应用直接退出或者退到后台, 直接保存数据到服务器, 不启用协程发送
|
||||
if (onQuit) {
|
||||
NetApi.UploadPlayerDataUpdate(version, json);
|
||||
return;
|
||||
}
|
||||
|
||||
NetApi.UploadPlayerDataUpdate(version, json, result => {
|
||||
if (result) {
|
||||
Log.Info("CloudDataSaver", $"最新数据版本: {version} ,更新成功");
|
||||
}
|
||||
else {
|
||||
Log.Warning("CloudDataSaver", $"最新数据版本: {version} ,更新失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e430f51fc26d4125843615d8de9e7f6c
|
||||
timeCreated: 1750659159
|
||||
@@ -0,0 +1,73 @@
|
||||
public static class DataKeys
|
||||
{
|
||||
public const string UserID = "UserID";
|
||||
public const string FirstLogin = "FirstLogin";
|
||||
public const string coin = "coin";
|
||||
public const string ticket = "ticket";
|
||||
public const string maxCoin = "maxCoin";
|
||||
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 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 adChFlyShowTime = "adChFlyShowTime";
|
||||
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 AdWatchCount = "AdWatchCount"; // 看广告次数
|
||||
public const string AvailableDiceRolls = "AvailableDiceRolls"; // 可摇骰子次数
|
||||
public const string propBackNum = "propBackNum"; // 返回道具数量
|
||||
public const string propRefreshNum = "propRefreshNum"; // 刷新道具数量
|
||||
public const string propRemoveNum = "propRemoveNum"; // 移除道具数量
|
||||
public const string resurrectionState = "resurrectionState"; //复活状态:4种,数字3为可以用广告和金币复活,2为只能用广告,1为只能用金币。0为不能复活
|
||||
public const string gameExperience = "gameExperience";
|
||||
public const string getFirstReaward = "getFirstReaward"; // 是否已领取新手奖励
|
||||
public const string noviceGuide = "noviceGuide"; // 是否新手引导
|
||||
public const string gameTime = "gameTime"; // 游戏时长
|
||||
public const string gameDay = "gameDay";
|
||||
public const string SecretUnlockList = "SecretUnlockList"; // 秘密相册解锁列表
|
||||
public const string SecretUnlockCd = "SecretUnlockCd"; // 秘密相册看广告的剩余时间
|
||||
public const string SecretUnlockADs = "SecretUnlockADs"; // 秘密相册看广告数(每一个图集的广告数不通用)
|
||||
public const string LiveUnlockCd = "LiveUnlockCd"; // 动态图鉴看广告的剩余时间cd
|
||||
public const string IsUnlockSecret = "IsUnlockSecret"; // 秘密相册是否解锁(-1:未解锁 0:刚解锁 1:已打开秘密相册)
|
||||
public const string VipLevel = "VipLevel"; // vip等级(1:7天 2:30天 3:365天)
|
||||
public const string VipExpirationTime = "VipExpirationTime"; // vip失效时间(默认为0)
|
||||
public const string VipTransactionID = "VipTransactionID"; //vip 购买后的订单id(如果没购买或者失效后,为"")
|
||||
public const string ApplePayTransactionID = "ApplePayTransactionID"; //ios购买后的非消耗性订单id
|
||||
public const string LiveDataList = "LiveDataList";
|
||||
public const string LiveDataDic = "LiveDataDic";
|
||||
public const string IsUnlockLive = "IsUnlockLive"; // live是否解锁(-1:未解锁 0:刚解锁 1:已打开live)
|
||||
public const string VipRequestNum = "VipRequestNum"; // 请求订阅数据,登录时的调用的次数
|
||||
|
||||
public const string LevelUnlockList = "LevelUnlockList"; // 图鉴已解锁的index列表
|
||||
|
||||
public const string IsUnlockChat = "IsUnlockChat";
|
||||
public const string ChatData = "ChatData";
|
||||
public const string ChatNumber = "ChatNumber";
|
||||
public const string ChatRecoverDays = "ChatRecoverDays";
|
||||
public const string ChatFreeNumber = "ChatFreeNumber";
|
||||
public const string curResVersion = "curResVersion";
|
||||
public const string LevelUnlockListNew = "LevelUnlockListNew";
|
||||
public const string LevelUnlockListFree = "LevelUnlockListFree";
|
||||
public const string LevelUnlockListAD = "LevelUnlockListAD";
|
||||
public const string LevelUnlockListSpecial = "LevelUnlockListSpecial";
|
||||
public const string LevelUnlockListVIP = "LevelUnlockListVIP";
|
||||
public const string selectLanguage = "selectLanguage";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc5eccf1420ec3a489eb815e618824c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,115 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 935e480d49b8ffa4381022530d2f6acc
|
||||
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: d352f19554a6f98469bd971e95579515
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace BallKingdomCrush {
|
||||
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: b456e1e40be344dd99c817ba250c2a0e
|
||||
timeCreated: 1692007381
|
||||
Reference in New Issue
Block a user