fix:1、添加项目。2、基本箭头生成
This commit is contained in:
@@ -0,0 +1,247 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SGModule.ConfigLoader;
|
||||
using SGModule.Net;
|
||||
using Newtonsoft.Json;
|
||||
using SGModule.NetKit;
|
||||
using IgnoreOPS;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class ConfigSystem : BaseSystem
|
||||
{
|
||||
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 ConfigSystem(bool isAutoInit = true)
|
||||
{
|
||||
if (isAutoInit)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed override void Init()
|
||||
{
|
||||
base.Init();
|
||||
AddListener();
|
||||
}
|
||||
|
||||
private void AddListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.AddListener(NetworkMsg.GetConfig, OnGetConfig);
|
||||
}
|
||||
|
||||
private void RemoveListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.GetConfig, OnGetConfig);
|
||||
}
|
||||
|
||||
private void OnGetConfig(object obj)
|
||||
{
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoadBegin); //加载开始打点
|
||||
int type = 0;
|
||||
if (obj != null) type = (int)obj;
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
ConfigLoader.Instance.Init(loginModel.Setting, loginModel.CdnURL, new List<ConfigModel>() {
|
||||
new CommonModel("Common"),
|
||||
new SignDailyRewardModel("SignDailyReward"),
|
||||
new TurntableModel("turntable"),
|
||||
new RewardNumModel("rewardNum"),
|
||||
new DurationtasksModel("Durationtasks"),
|
||||
new PassingTaskModel("PassingTasks"),
|
||||
new PassportrewardsModel("Passportrewards"),
|
||||
new ADTaskModel("ADTasks"),
|
||||
new SmallrewardNumModel("SmallrewardNum"),
|
||||
new LargerewardNumModel("LargerewardNum"),
|
||||
new PaidcoinsModel("Paidcoins"),
|
||||
new PaidgiftModel("Paidgift"),
|
||||
new OnlineRewardsModel("OnlineRewards"),
|
||||
new MakeupModel("makeup"),
|
||||
new GameUrlsModel("GameUrls"),
|
||||
new exBrPoolModel("exBrPool"),
|
||||
new RankHourRewardsModel("RankHourRewards"),
|
||||
new RankDayRewardsModel("RankDayRewards"),
|
||||
new RankWeekRewardsModel("RankWeekRewards"),
|
||||
new MakeupModel_2("makeup_2"),
|
||||
new exBrPoolModel_2("exBrPool_2"),
|
||||
new MultigiftModel("Multigift"),
|
||||
new ApplePayModel("applePay"),
|
||||
// new ApplePayModel2("applePay2"),
|
||||
new FAQRuleModel("FAQRule"),
|
||||
new FAQRuleModel1("FAQRule_1"),
|
||||
new MessageBoardModel("MessageBoard"),
|
||||
new MessageBoardModel1("MessageBoard_1"),
|
||||
new LevelAttemptsModel("LevelAttempts"),
|
||||
new TurnOffRewardsModel("TurnOffRewards"),
|
||||
new ExchangeDesModel("ExchangeDescriptors"),
|
||||
new AppOpenAdModel("SplashAD"),
|
||||
},
|
||||
state =>
|
||||
{
|
||||
Debug.Log($"配置加载状态{state}");
|
||||
// Debug.Log(JsonConvert.SerializeObject(ConfigSystem.GetConfig<ApplePayModel>().DataList));
|
||||
if (state == ConfigLoaderState.Successful)
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
Debug.Log(GameHelper.NeedShowOpenAd());
|
||||
if (GameHelper.NeedShowOpenAd() && GameHelper.IsGiftSwitch())
|
||||
{
|
||||
GameHelper.ShowOpenAd();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.CloseMask);
|
||||
}
|
||||
}
|
||||
ReloadConfig();
|
||||
}
|
||||
},
|
||||
(errorName, message) =>
|
||||
{
|
||||
Debug.LogError($"配置解析错误 {errorName} 错误信息:{message}");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重新加载配置
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
private void ReloadConfig()
|
||||
{
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoadFinish);//加载完成打点
|
||||
ParseGameConfig();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||||
if (SaveData.GetSaveObject().ExchangeProcessMode < 0)
|
||||
{
|
||||
SaveData.GetSaveObject().ExchangeModeToggle = ConfigSystem.GetConfig<CommonModel>().ExchangeModeToggle;
|
||||
SaveData.GetSaveObject().ExchangeProcessMode = ConfigSystem.GetConfig<CommonModel>().ExchangeProcessMode;
|
||||
SaveData.GetSaveObject().CHProcessMode = ConfigSystem.GetConfig<CommonModel>().CHProcessMode;
|
||||
}
|
||||
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartBefore);
|
||||
|
||||
SaveingPotHelper.ResetHistory();
|
||||
}
|
||||
|
||||
|
||||
#region 游戏配置
|
||||
|
||||
private void ParseGameConfig()
|
||||
{
|
||||
|
||||
var exBrPoolModel = GetConfig<exBrPoolModel>();
|
||||
if (exBrPoolModel != null && exBrPoolModel.DataList.Count > 0)
|
||||
{
|
||||
exBrPoolModel.config_name_list = exBrPoolModel.DataList[0].user_name.Split(",").ToList();
|
||||
exBrPoolModel.config_money_list = exBrPoolModel.DataList[0].amount.Split(",").ToList();
|
||||
}
|
||||
|
||||
var exBrPoolModel2 = GetConfig<exBrPoolModel_2>();
|
||||
if (exBrPoolModel2 != null && exBrPoolModel2.DataList.Count > 0)
|
||||
{
|
||||
exBrPoolModel2.config_name_list = exBrPoolModel2.DataList[0].user_name.Split(",").ToList();
|
||||
exBrPoolModel2.config_money_list = exBrPoolModel2.DataList[0].amount.Split(",").ToList();
|
||||
}
|
||||
var LevelAttemptsModel_ = GetConfig<LevelAttemptsModel>();
|
||||
if (LevelAttemptsModel_ != null && LevelAttemptsModel_.DataList.Count > 0)
|
||||
{
|
||||
LevelAttemptsModel_.config_name_list = LevelAttemptsModel_.DataList[0].user_name.Split(",").ToList();
|
||||
LevelAttemptsModel_.config_money_list = LevelAttemptsModel_.DataList[0].amount.Split(",").ToList();
|
||||
}
|
||||
|
||||
var jsonDictionary = ConfigLoader.Instance.JsonDictionary;
|
||||
var gameConfigModel = new GameConfigModel("GameBoard");
|
||||
foreach (var item in jsonDictionary)
|
||||
{
|
||||
if (item.Key.StartsWith("GameBoard"))
|
||||
{
|
||||
string[] parts = item.Key.Split('_');
|
||||
|
||||
int boardIndex;
|
||||
if (parts.Length > 1 && int.TryParse(parts[1], out boardIndex))
|
||||
{
|
||||
// 成功解析出数字
|
||||
Debug.Log($"[barry] jiexi boardIndex==== {boardIndex}");
|
||||
}
|
||||
else
|
||||
{
|
||||
boardIndex = 1;
|
||||
}
|
||||
|
||||
if (jsonDictionary.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigLoader.Instance.AddConfig(gameConfigModel);
|
||||
|
||||
SetGameUrlConfig();
|
||||
}
|
||||
private static List<GameUrls> data_new;
|
||||
|
||||
public static void SetGameUrlConfig()
|
||||
{
|
||||
|
||||
|
||||
light_weblist.Clear();
|
||||
dark_weblist.Clear();
|
||||
web_through_str = "";
|
||||
data_new = GetConfig<GameUrlsModel>().DataList;
|
||||
List<int> type_list = new List<int>();
|
||||
for (int i = 0; i < data_new.Count; i++)
|
||||
{
|
||||
|
||||
if (data_new[i].webType == 2)
|
||||
{
|
||||
if (GameHelper.IsGiftSwitch() && (data_new[i].isMagic == 1)) light_weblist.Add(data_new[i]);
|
||||
else if (!GameHelper.IsGiftSwitch() && (data_new[i].isMagic == 0)) light_weblist.Add(data_new[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dark_weblist.Add(data_new[i]);
|
||||
if (!type_list.Contains(data_new[i].wvType))
|
||||
{
|
||||
web_through_str += data_new[i].wvthrough;
|
||||
web_through_str += "|";
|
||||
type_list.Add(data_new[i].wvType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
web_through_str.Remove(web_through_str.Length - 1);
|
||||
|
||||
Debug.Log("light_weblist-----" + light_weblist.Count);
|
||||
Debug.Log("dark_weblist-----"+ dark_weblist.Count);
|
||||
Debug.Log("////////////////////////");
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static T GetConfig<T>()
|
||||
{
|
||||
return ConfigLoader.Instance.GetConfig<T>();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a3bd721f95842948573aea8599cd364
|
||||
timeCreated: 1692603665
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using SGModule.Net;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class LoginSystem : BaseSystem
|
||||
{
|
||||
|
||||
private int loginCount = 0;
|
||||
public LoginSystem(bool isAutoInit = true)
|
||||
{
|
||||
if (isAutoInit)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
public static string attribution = "";
|
||||
|
||||
public sealed override void Init()
|
||||
{
|
||||
base.Init();
|
||||
InitData();
|
||||
AddListener();
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
}
|
||||
|
||||
private void AddListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.AddListener(NetworkMsg.Login, RequestLogin);
|
||||
}
|
||||
|
||||
private void RemoveListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.Login, RequestLogin);
|
||||
}
|
||||
|
||||
private TimerTask timerTask = null;
|
||||
private void RequestLogin(object obj = null)
|
||||
{
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginSend);
|
||||
LoginKit.Instance.LoginRequest(SuperApplication.Instance.attribution, NetworkManager.haveSimCard, (isSuccess, loginData) =>
|
||||
{
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginRecv, isSuccess ? "success" : "fail");
|
||||
if (isSuccess)
|
||||
{
|
||||
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.UpdateHotFixProgress, 97);
|
||||
|
||||
// MaxADKit.SetUserID(loginData.Uid.ToString());
|
||||
|
||||
DateTimeManager.Instance.SetServerCurrTimestamp(loginData.LoginTime);
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
|
||||
void OnFail()
|
||||
{
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
}
|
||||
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, (Action)OnFail);zhushi
|
||||
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
//
|
||||
// float times = loginCount == 0 ? 0 : 5f;
|
||||
//
|
||||
// DOVirtual.DelayedCall(times,()=>{
|
||||
// if (loginCount < 5) {
|
||||
// loginCount++;
|
||||
// RequestLogin();
|
||||
//
|
||||
// } else {
|
||||
// loginCount = 0;
|
||||
// Action _OnFail = () =>
|
||||
// {
|
||||
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
// };
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e448e373b1b484b8918ec80a7f28448
|
||||
timeCreated: 1692267393
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections.Generic;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Net;
|
||||
using SGModule.NetKit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChillConnect
|
||||
{
|
||||
public class PlayDataSystem : BaseSystem
|
||||
{
|
||||
public PlayDataSystem(bool isAutoInit = true)
|
||||
{
|
||||
if (isAutoInit)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
AddListener();
|
||||
}
|
||||
|
||||
private void AddListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.AddListener(NetworkMsg.GetPlayData, OnRequestPlayData);
|
||||
NetworkDispatcher.Instance.AddListener(NetworkMsg.SavePlayData, OnRequestSavePlayData);
|
||||
}
|
||||
|
||||
private void RemoveListener()
|
||||
{
|
||||
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.GetPlayData, OnRequestPlayData);
|
||||
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.SavePlayData, OnRequestSavePlayData);
|
||||
}
|
||||
|
||||
private void OnRequestPlayData(object args) {
|
||||
NetApi.RequestPlayerData((isSuccess, json) => {
|
||||
Debug.Log($"barry UserData : {json}");
|
||||
if (isSuccess) {
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
if (loginModel.NewPlayer || loginModel.Uid != DataMgr.UserID.Value)
|
||||
{
|
||||
SaveLocalData.clearRankData();
|
||||
GameHelper.clearJsonData();
|
||||
}
|
||||
DataMgr.InitPreferences(json);
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetConfig);
|
||||
}
|
||||
else {
|
||||
Debug.LogError($"OnRequestPlayData isError {json}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void OnRequestSavePlayData(object obj)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
var msg = obj as Dictionary<string, object>;
|
||||
|
||||
if (msg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var version = 1L;
|
||||
if (msg.TryGetValue("data_ver", out var ver))
|
||||
{
|
||||
if (version != default)
|
||||
{
|
||||
version = (long)ver;
|
||||
}
|
||||
}
|
||||
|
||||
var data = SerializeUtil.ToJson<Dictionary<string, object>>(msg);
|
||||
|
||||
var requestData = new RequestSavePlayData
|
||||
{
|
||||
version = version,
|
||||
data = data
|
||||
};
|
||||
// NetworkKit.PostWithHeader("user/updateData", requestData);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
// RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b2141f8f0f64581b0f291d0ca27ece2
|
||||
timeCreated: 1692343794
|
||||
Reference in New Issue
Block a user