473 lines
20 KiB
C#
473 lines
20 KiB
C#
|
|
using System;
|
||
|
|
using System.IO;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
using Unity.VisualScripting;
|
||
|
|
|
||
|
|
namespace FlowerPower
|
||
|
|
{
|
||
|
|
|
||
|
|
public class ConfigSystem : BaseSystem
|
||
|
|
{
|
||
|
|
private static Dictionary<Type, object> configData = new Dictionary<Type, object>();
|
||
|
|
public static List<GameUrls> light_weblist = new List<GameUrls>();
|
||
|
|
public static List<GameUrls> dark_weblist = new List<GameUrls>();
|
||
|
|
public static string web_through_str;
|
||
|
|
public static int requestConfigType = 0;
|
||
|
|
public ConfigSystem(bool isAutoInit = true)
|
||
|
|
{
|
||
|
|
if (isAutoInit)
|
||
|
|
{
|
||
|
|
Init();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public sealed override void Init()
|
||
|
|
{
|
||
|
|
base.Init();
|
||
|
|
AddListener();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void AddListener()
|
||
|
|
{
|
||
|
|
NetworkDispatcher.Instance.AddListener(NetworkMsg.GetConfig, OnRequestGetConfig);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void RemoveListener()
|
||
|
|
{
|
||
|
|
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.GetConfig, OnRequestGetConfig);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnRequestGetConfig(object obj)
|
||
|
|
{
|
||
|
|
|
||
|
|
var reqData = new RespLoginFunnelData
|
||
|
|
{
|
||
|
|
type = "loadBegin",
|
||
|
|
payload = ""
|
||
|
|
};
|
||
|
|
NetworkKit.PostFunnelLogin(reqData);
|
||
|
|
|
||
|
|
if (obj != null) requestConfigType = (int)obj;
|
||
|
|
|
||
|
|
|
||
|
|
var loginData = GameHelper.GetLoginModel();
|
||
|
|
|
||
|
|
var configFileName = "JarvisConfigFile";
|
||
|
|
var configFileSavePath = $"{GemCrushFileKit.GetSavePath()}/Config/";
|
||
|
|
var assetHotFixFilePath = $"{configFileSavePath}{configFileName}.txt";
|
||
|
|
var configFileNameKey = "configFileName";
|
||
|
|
var CDNConfigFileName = loginData.setting;
|
||
|
|
|
||
|
|
string savedCfgName = PlayerPrefs.GetString(configFileNameKey);
|
||
|
|
bool needDownloadConfigFile = false;
|
||
|
|
|
||
|
|
if (!string.IsNullOrEmpty(CDNConfigFileName))
|
||
|
|
{
|
||
|
|
//如果本地Player Prefs里没有保存配置文件名
|
||
|
|
if (string.IsNullOrEmpty(savedCfgName))
|
||
|
|
{
|
||
|
|
// Debug.Log("[UNITY] No config file name saved.");
|
||
|
|
needDownloadConfigFile = true;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
Debug.Log($"[UNITY] Saved config name: {savedCfgName}, CDN config name: {CDNConfigFileName}");
|
||
|
|
//与CDN上的对比名称
|
||
|
|
if (!savedCfgName.Equals(CDNConfigFileName))
|
||
|
|
{
|
||
|
|
needDownloadConfigFile = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Debug.Log($"[UNITY] needDownloadConfigFile: {needDownloadConfigFile}");
|
||
|
|
//默默地拉去新配置
|
||
|
|
if (needDownloadConfigFile)
|
||
|
|
{
|
||
|
|
CrazyAsyKit.StartCoroutine(DownloadKit.GetTextFromUrl($"{NetworkKit.CDNUrl}config/{CDNConfigFileName}",
|
||
|
|
configFileName, (content) =>
|
||
|
|
{
|
||
|
|
if (content == null)
|
||
|
|
{
|
||
|
|
Debug.Log("down config error");
|
||
|
|
loadLocalConfig(assetHotFixFilePath, configFileName, configFileSavePath);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
Debug.Log("down config success");
|
||
|
|
PlayerPrefs.SetString(configFileNameKey, CDNConfigFileName);
|
||
|
|
ParseConfig(content);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||
|
|
var reqData = new RespLoginFunnelData
|
||
|
|
{
|
||
|
|
type = "loadFinish",
|
||
|
|
payload = ""
|
||
|
|
};
|
||
|
|
NetworkKit.PostFunnelLogin(reqData);
|
||
|
|
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||
|
|
}
|
||
|
|
SaveingPotHelper.ResetHistory();
|
||
|
|
}, configFileSavePath));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
loadLocalConfig(assetHotFixFilePath, configFileName, configFileSavePath);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void loadLocalConfig(string assetHotFixFilePath, string configFileName, string configFileSavePath)
|
||
|
|
{
|
||
|
|
if (File.Exists(assetHotFixFilePath))
|
||
|
|
{
|
||
|
|
ParseConfig(File.ReadAllText(assetHotFixFilePath));
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||
|
|
var reqData = new RespLoginFunnelData
|
||
|
|
{
|
||
|
|
type = "loadFinish",
|
||
|
|
payload = ""
|
||
|
|
};
|
||
|
|
NetworkKit.PostFunnelLogin(reqData);
|
||
|
|
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
var path = $"{Application.streamingAssetsPath}/Config/{configFileName}.txt";
|
||
|
|
#if UNITY_IOS
|
||
|
|
path = "file://" + path;
|
||
|
|
#endif
|
||
|
|
// Debug.Log($"[UNITY] Load config from streaming asset: {path}");
|
||
|
|
CrazyAsyKit.StartCoroutine(DownloadKit.GetTextFromUrl(path, configFileName, content =>
|
||
|
|
{
|
||
|
|
ParseConfig(content);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||
|
|
var reqData = new RespLoginFunnelData
|
||
|
|
{
|
||
|
|
type = "loadFinish",
|
||
|
|
payload = ""
|
||
|
|
};
|
||
|
|
NetworkKit.PostFunnelLogin(reqData);
|
||
|
|
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||
|
|
}, configFileSavePath));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ParseConfig(string json)
|
||
|
|
{
|
||
|
|
if (json == null)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (!json.StartsWith("{"))
|
||
|
|
{
|
||
|
|
json = Base64Kit.Decode(json, NetworkManager.identifier);
|
||
|
|
}
|
||
|
|
|
||
|
|
var dictionary = SerializeUtil.ToObject<Dictionary<string, object>>(json);
|
||
|
|
ParseGameConfig(dictionary);
|
||
|
|
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartBefore);
|
||
|
|
|
||
|
|
if (requestConfigType == 0)
|
||
|
|
{
|
||
|
|
// Debug.Log("NeedShowOpenAd----0-");
|
||
|
|
if (GameHelper.NeedShowOpenAd())
|
||
|
|
{
|
||
|
|
Debug.Log("NeedShowOpenAd----0-");
|
||
|
|
GameHelper.ShowOpenAd();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.CloseMask);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var reqData1 = new RespLoginFunnelData
|
||
|
|
{
|
||
|
|
type = "loadFinish",
|
||
|
|
payload = ""
|
||
|
|
};
|
||
|
|
NetworkKit.PostFunnelLogin(reqData1);
|
||
|
|
}
|
||
|
|
|
||
|
|
#region 游戏配置
|
||
|
|
|
||
|
|
private void ParseGameConfig(IReadOnlyDictionary<string, object> dictionary)
|
||
|
|
{
|
||
|
|
if (dictionary.TryGetValue("Common", out var common))
|
||
|
|
{
|
||
|
|
var commonModel = SerializeUtil.ToObject<CommonModel>(common.ToString());
|
||
|
|
configData[typeof(CommonModel)] = commonModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
var GameConfigModel = new GameConfigModel();
|
||
|
|
|
||
|
|
foreach (var item in dictionary)
|
||
|
|
{
|
||
|
|
if (item.Key.StartsWith("GameBoard"))
|
||
|
|
{
|
||
|
|
string[] parts = item.Key.Split('_');
|
||
|
|
|
||
|
|
int boardIndex;
|
||
|
|
if (parts.Length > 1 && int.TryParse(parts[1], out boardIndex))
|
||
|
|
{
|
||
|
|
// 成功解析出数字
|
||
|
|
// Debug.Log($"boardIndex==== {boardIndex}");
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
boardIndex = 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue(item.Key, out var gameboard))
|
||
|
|
{
|
||
|
|
|
||
|
|
if (!GameConfigModel.game_conf.ContainsKey(boardIndex))
|
||
|
|
{
|
||
|
|
GameConfigModel.game_conf.Add(boardIndex, null);
|
||
|
|
}
|
||
|
|
|
||
|
|
GameConfigModel.game_conf[boardIndex] = SerializeUtil.ToObject<List<GameBoard>>(gameboard.ToString());
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
configData[typeof(GameConfigModel)] = GameConfigModel;
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("SignDailyReward", out var signDailyReward))
|
||
|
|
{
|
||
|
|
var signDailyRewardModel = new SignDailyRewardModel();
|
||
|
|
|
||
|
|
signDailyRewardModel.dataList = SerializeUtil.ToObject<List<SignDailyReward>>(signDailyReward.ToString());
|
||
|
|
|
||
|
|
configData[typeof(SignDailyRewardModel)] = signDailyRewardModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("turntable", out var turntable))
|
||
|
|
{
|
||
|
|
var turntableModel = new TurntableModel();
|
||
|
|
turntableModel.dataList = SerializeUtil.ToObject<List<Turntable>>(turntable.ToString());
|
||
|
|
configData[typeof(TurntableModel)] = turntableModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("rewardNum", out var rewardNum))
|
||
|
|
{
|
||
|
|
var rewardNumModel = new RewardNumModel();
|
||
|
|
rewardNumModel.dataList = SerializeUtil.ToObject<List<RewardNum>>(rewardNum.ToString());
|
||
|
|
configData[typeof(RewardNumModel)] = rewardNumModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("Durationtasks", out var durationtasks))
|
||
|
|
{
|
||
|
|
var DurationtasksModel = new DurationtasksModel();
|
||
|
|
DurationtasksModel.dataList = SerializeUtil.ToObject<List<Durationtasks>>(durationtasks.ToString());
|
||
|
|
configData[typeof(DurationtasksModel)] = DurationtasksModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("PassingTasks", out var passingtask))
|
||
|
|
{
|
||
|
|
var PassingTaskModel = new PassingTaskModel();
|
||
|
|
PassingTaskModel.dataList = SerializeUtil.ToObject<List<PassingTask>>(passingtask.ToString());
|
||
|
|
configData[typeof(PassingTaskModel)] = PassingTaskModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("ADTasks", out var adtask))
|
||
|
|
{
|
||
|
|
var ADTaskModel = new ADTaskModel();
|
||
|
|
ADTaskModel.dataList = SerializeUtil.ToObject<List<ADTask>>(adtask.ToString());
|
||
|
|
configData[typeof(ADTaskModel)] = ADTaskModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("Passportrewards", out var Passportrewards))
|
||
|
|
{
|
||
|
|
var PassportrewardsModel = new PassportrewardsModel();
|
||
|
|
PassportrewardsModel.dataList = SerializeUtil.ToObject<List<Passportrewards>>(Passportrewards.ToString());
|
||
|
|
configData[typeof(PassportrewardsModel)] = PassportrewardsModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("SmallrewardNum", out var SmallrewardNum))
|
||
|
|
{
|
||
|
|
var SmallrewardNumModel = new SmallrewardNumModel();
|
||
|
|
SmallrewardNumModel.dataList = SerializeUtil.ToObject<List<SmallrewardNum>>(SmallrewardNum.ToString());
|
||
|
|
configData[typeof(SmallrewardNumModel)] = SmallrewardNumModel;
|
||
|
|
// Debug.Log(SmallrewardNum.ToString());
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("LargerewardNum", out var LargerewardNum))
|
||
|
|
{
|
||
|
|
var LargerewardNumModel = new LargerewardNumModel();
|
||
|
|
LargerewardNumModel.dataList = SerializeUtil.ToObject<List<LargerewardNum>>(LargerewardNum.ToString());
|
||
|
|
configData[typeof(LargerewardNumModel)] = LargerewardNumModel;
|
||
|
|
// Debug.Log(LargerewardNum.ToString());
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("exBrPool", out var exBrPool))
|
||
|
|
{
|
||
|
|
var exBrPoolModel = new exBrPoolModel();
|
||
|
|
exBrPoolModel.dataList = SerializeUtil.ToObject<List<exBrPool>>(exBrPool.ToString());
|
||
|
|
configData[typeof(exBrPoolModel)] = exBrPoolModel;
|
||
|
|
ConfigSystem.GetConfig<exBrPoolModel>().config_name_list = ConfigSystem.GetConfig<exBrPoolModel>().dataList[0].user_name.Split(",").ToList();
|
||
|
|
ConfigSystem.GetConfig<exBrPoolModel>().config_money_list = ConfigSystem.GetConfig<exBrPoolModel>().dataList[0].amount.Split(",").ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("exBrPool_2", out var exBrPool_2))
|
||
|
|
{
|
||
|
|
var exBrPoolModel_2 = new exBrPoolModel_2
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<exBrPool_2>>(exBrPool_2.ToString()) };
|
||
|
|
configData[typeof(exBrPoolModel_2)] = exBrPoolModel_2;
|
||
|
|
ConfigSystem.GetConfig<exBrPoolModel_2>().config_name_list = ConfigSystem.GetConfig<exBrPoolModel_2>().dataList[0].user_name.Split(",").ToList();
|
||
|
|
ConfigSystem.GetConfig<exBrPoolModel_2>().config_money_list = ConfigSystem.GetConfig<exBrPoolModel_2>().dataList[0].amount.Split(",").ToList();
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("makeup", out var makeup))
|
||
|
|
{
|
||
|
|
var makeupModel = new MakeupModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<Makeup>>(makeup.ToString()) };
|
||
|
|
configData[typeof(MakeupModel)] = makeupModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("makeup_2", out var makeup_2))
|
||
|
|
{
|
||
|
|
var makeupModel_2 = new MakeupModel_2
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<Makeup_2>>(makeup_2.ToString()) };
|
||
|
|
Debug.Log("---------------" + makeup_2.ToString());
|
||
|
|
configData[typeof(MakeupModel_2)] = makeupModel_2;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("GameUrls", out var GameUrls))
|
||
|
|
{
|
||
|
|
light_weblist.Clear();
|
||
|
|
dark_weblist.Clear();
|
||
|
|
web_through_str = "";
|
||
|
|
List<GameUrls> alllist = new List<GameUrls>();
|
||
|
|
alllist = SerializeUtil.ToObject<List<GameUrls>>(GameUrls.ToString());
|
||
|
|
List<int> type_list = new List<int>();
|
||
|
|
for (int i = 0; i < alllist.Count; i++)
|
||
|
|
{
|
||
|
|
if (alllist[i].webType == 2)
|
||
|
|
{
|
||
|
|
if (GameHelper.IsGiftSwitch() && (alllist[i].isMagic == 1)) light_weblist.Add(alllist[i]);
|
||
|
|
else if (!GameHelper.IsGiftSwitch() && (alllist[i].isMagic == 0)) light_weblist.Add(alllist[i]);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
dark_weblist.Add(alllist[i]);
|
||
|
|
if (!type_list.Contains(alllist[i].wvType))
|
||
|
|
{
|
||
|
|
web_through_str += alllist[i].wvthrough;
|
||
|
|
web_through_str += "|";
|
||
|
|
type_list.Add(alllist[i].wvType);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
web_through_str.Remove(web_through_str.Length - 1);
|
||
|
|
var gameUrlsModel = new GameUrlsModel
|
||
|
|
{
|
||
|
|
dataList = light_weblist
|
||
|
|
};
|
||
|
|
configData[typeof(GameUrlsModel)] = gameUrlsModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("Paidcoins", out var Paidcoins))
|
||
|
|
{
|
||
|
|
var PaidcoinsModel = new PaidcoinsModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<Paidcoins>>(Paidcoins.ToString()) };
|
||
|
|
configData[typeof(PaidcoinsModel)] = PaidcoinsModel;
|
||
|
|
// Debug.Log(Paidcoins.ToString());
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dictionary.TryGetValue("Paidgift", out var Paidgift))
|
||
|
|
{
|
||
|
|
var PaidgiftModel = new PaidgiftModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<Paidgift>>(Paidgift.ToString()) };
|
||
|
|
configData[typeof(PaidgiftModel)] = PaidgiftModel;
|
||
|
|
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("Multigift", out var Multigift))
|
||
|
|
{
|
||
|
|
var MultigiftModel = new MultigiftModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<Multigift>>(Multigift.ToString()) };
|
||
|
|
configData[typeof(MultigiftModel)] = MultigiftModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("FAQRule", out var FAQRule))
|
||
|
|
{
|
||
|
|
var FaqModel = new FAQRuleModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<FAQRule>>(FAQRule.ToString()) };
|
||
|
|
configData[typeof(FAQRuleModel)] = FaqModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("FAQRule_1", out var FAQRule_1))
|
||
|
|
{
|
||
|
|
var FaqModel = new FAQRuleModel_1
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<FAQRule>>(FAQRule_1.ToString()) };
|
||
|
|
configData[typeof(FAQRuleModel_1)] = FaqModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("MessageBoard", out var MessageBoard))
|
||
|
|
{
|
||
|
|
var messageModel = new MessageBoardModel
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<MessageBoard>>(MessageBoard.ToString()) };
|
||
|
|
configData[typeof(MessageBoardModel)] = messageModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("MessageBoard_1", out var MessageBoard_1))
|
||
|
|
{
|
||
|
|
var messageModel = new MessageBoardModel_1
|
||
|
|
{ dataList = SerializeUtil.ToObject<List<MessageBoard>>(MessageBoard_1.ToString()) };
|
||
|
|
configData[typeof(MessageBoardModel_1)] = messageModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("RankHourRewards", out var RankHourRewards))
|
||
|
|
{
|
||
|
|
var RankHourRewardsModel = new RankHourRewardsModel();
|
||
|
|
RankHourRewardsModel.dataList = SerializeUtil.ToObject<List<RankRewards>>(RankHourRewards.ToString());
|
||
|
|
configData[typeof(RankHourRewardsModel)] = RankHourRewardsModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("RankDayRewards", out var RankDayRewards))
|
||
|
|
{
|
||
|
|
var RankDayRewardsModel = new RankDayRewardsModel();
|
||
|
|
RankDayRewardsModel.dataList = SerializeUtil.ToObject<List<RankRewards>>(RankDayRewards.ToString());
|
||
|
|
configData[typeof(RankDayRewardsModel)] = RankDayRewardsModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("RankWeekRewards", out var RankWeekRewards))
|
||
|
|
{
|
||
|
|
var RankWeekRewardsModel = new RankWeekRewardsModel();
|
||
|
|
RankWeekRewardsModel.dataList = SerializeUtil.ToObject<List<RankRewards>>(RankWeekRewards.ToString());
|
||
|
|
configData[typeof(RankWeekRewardsModel)] = RankWeekRewardsModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("TurnOffRewards", out var TurnOffRewards))
|
||
|
|
{
|
||
|
|
var TurnOffRewardsModel = new TurnOffRewardsModel();
|
||
|
|
TurnOffRewardsModel.dataList = SerializeUtil.ToObject<List<TurnOffRewards>>(TurnOffRewards.ToString());
|
||
|
|
configData[typeof(TurnOffRewardsModel)] = TurnOffRewardsModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("LevelAttempts", out var LevelAttempts))
|
||
|
|
{
|
||
|
|
var LevelAttemptsModel = new LevelAttemptsModel();
|
||
|
|
LevelAttemptsModel.dataList = SerializeUtil.ToObject<List<LevelAttempts>>(LevelAttempts.ToString());
|
||
|
|
configData[typeof(LevelAttemptsModel)] = LevelAttemptsModel;
|
||
|
|
ConfigSystem.GetConfig<LevelAttemptsModel>().config_name_list = ConfigSystem.GetConfig<LevelAttemptsModel>().dataList[0].user_name.Split(",").ToList();
|
||
|
|
ConfigSystem.GetConfig<LevelAttemptsModel>().config_money_list = ConfigSystem.GetConfig<LevelAttemptsModel>().dataList[0].amount.Split(",").ToList();
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("ExchangeDescriptors", out var ExchangeDescriptors))
|
||
|
|
{
|
||
|
|
var ExchangeDesModel = new ExchangeDesModel();
|
||
|
|
ExchangeDesModel.dataList = SerializeUtil.ToObject<List<ExchangeDes>>(ExchangeDescriptors.ToString());
|
||
|
|
configData[typeof(ExchangeDesModel)] = ExchangeDesModel;
|
||
|
|
}
|
||
|
|
if (dictionary.TryGetValue("SplashAD", out var SplashAD))
|
||
|
|
{
|
||
|
|
var AppOpenAdModel = new AppOpenAdModel();
|
||
|
|
AppOpenAdModel.dataList = SerializeUtil.ToObject<List<SplashAD>>(SplashAD.ToString());
|
||
|
|
configData[typeof(AppOpenAdModel)] = AppOpenAdModel;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
public static T GetConfig<T>()
|
||
|
|
{
|
||
|
|
return configData.TryGetValue(typeof(T), out var value) ? (T)value : default;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Dispose()
|
||
|
|
{
|
||
|
|
base.Dispose();
|
||
|
|
RemoveListener();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|