fix:1、修复bug 2、删除不用的代码和资源,sdk等
This commit is contained in:
@@ -1,150 +1,178 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Common.Extensions;
|
||||
using SGModule.Common.Helper;
|
||||
using SGModule.ConfigLoader;
|
||||
using SGModule.NetKit;
|
||||
using UnityEngine;
|
||||
using CommonModel = IgnoreOPS.CommonModel;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class ConfigSystem : BaseSystem
|
||||
{
|
||||
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); //加载开始打点
|
||||
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
Log.Info("Config", $"服务器传过来的配置表:{loginModel.Setting}");
|
||||
ConfigLoader.Instance.Init(new ConfigInitOptions
|
||||
{
|
||||
Setting = loginModel.Setting,
|
||||
CdnUrl = loginModel.CdnURL,
|
||||
OnComplete = state =>
|
||||
{
|
||||
Debug.Log($"配置加载状态{state}");
|
||||
if (state == ConfigLoaderState.Successful)
|
||||
{
|
||||
ReloadConfig();
|
||||
}
|
||||
},
|
||||
OnError = (errorName, message) => { Debug.LogError($"配置解析错误 {errorName} 错误信息:{message}"); },
|
||||
OnHandleUnmarkedConfig = ParseGameConfig
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重新加载配置
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
private void ReloadConfig()
|
||||
{
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoadFinish); //加载完成打点
|
||||
|
||||
ParseGameConfig();
|
||||
TextureHelper.imgUrl = LoginKit.Instance.LoginModel.CdnURL + "/" + ConfigSystem.GetCommonConf().ResVersion + "/";
|
||||
LiveVideoManager.videoBaseUrl = LoginKit.Instance.LoginModel.CdnURL + "/" + ConfigSystem.GetCommonConf().ResVersion + "/";
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||||
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartBefore);
|
||||
SaveingPotHelper.ResetHistory();
|
||||
}
|
||||
|
||||
|
||||
#region 游戏配置
|
||||
|
||||
private void ParseGameConfig()
|
||||
{
|
||||
var gameConfigModel = new GameConfigModel();
|
||||
foreach (var key in ConfigLoader.Instance.GetJsonKeys())
|
||||
{
|
||||
if (!key.StartsWith("GameBoard"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 提取 boardIndex
|
||||
var boardIndex = 1;
|
||||
var parts = key.Split('_');
|
||||
if (parts.Length > 1 && int.TryParse(parts[1], out var parsed))
|
||||
{
|
||||
boardIndex = parsed;
|
||||
}
|
||||
|
||||
// 获取 json 并反序列化
|
||||
if (ConfigLoader.Instance.TryGetJsonValue(key, out var gameboardJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameBoards = gameboardJson.As<List<GameBoard>>();
|
||||
if (gameBoards != null)
|
||||
{
|
||||
gameConfigModel.game_conf[boardIndex] = gameBoards;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ConfigLoader.Warning($"GameBoard 配置 {key} 反序列化为空");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConfigLoader.Error($"GameBoard 配置 {key} 反序列化失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigLoader.Instance.AddConfig(gameConfigModel);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public static CommonModel GetCommonConf()
|
||||
{
|
||||
return ConfigLoader.Instance.GetConfig<CommonModel>();
|
||||
}
|
||||
|
||||
public static List<T> GetConfig<T>() where T : class
|
||||
{
|
||||
return ConfigLoader.Instance.GetConfig<List<T>>() ?? new List<T>();
|
||||
}
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Common.Extensions;
|
||||
using SGModule.Common.Helper;
|
||||
using SGModule.ConfigLoader;
|
||||
using SGModule.NetKit;
|
||||
using UnityEngine;
|
||||
using CommonModel = IgnoreOPS.CommonModel;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class ConfigSystem : BaseSystem
|
||||
{
|
||||
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); //加载开始打点
|
||||
|
||||
var loginModel = LoginKit.Instance.LoginModel;
|
||||
Log.Info("Config", $"服务器传过来的配置表:{loginModel.Setting}");
|
||||
ConfigLoader.Instance.Init(new ConfigInitOptions
|
||||
{
|
||||
Setting = loginModel.Setting,
|
||||
CdnUrl = loginModel.CdnURL,
|
||||
OnComplete = state =>
|
||||
{
|
||||
Debug.Log($"配置加载状态{state}");
|
||||
if (state == ConfigLoaderState.Successful)
|
||||
{
|
||||
ReloadConfig();
|
||||
}
|
||||
},
|
||||
OnError = (errorName, message) => { Debug.LogError($"配置解析错误 {errorName} 错误信息:{message}"); },
|
||||
OnHandleUnmarkedConfig = ParseGameConfig
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重新加载配置
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
|
||||
private void ReloadConfig()
|
||||
{
|
||||
var CdnURL = "https://asserts.minskyfun.top";
|
||||
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoadFinish); //加载完成打点
|
||||
|
||||
ParseGameConfig();
|
||||
TextureHelper.imgUrl = CdnURL + "/" + ConfigSystem.GetCommonConf().ResVersion + "/";
|
||||
LiveVideoManager.videoBaseUrl = CdnURL + "/" + ConfigSystem.GetCommonConf().ResVersion + "/";
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
AppDispatcher.Instance.Dispatch(AppMsg.LoginInit);
|
||||
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartBefore);
|
||||
SaveingPotHelper.ResetHistory();
|
||||
}
|
||||
|
||||
|
||||
#region 游戏配置
|
||||
|
||||
private void ParseGameConfig()
|
||||
{
|
||||
var gameConfigModel = new GameConfigModel();
|
||||
foreach (var key in ConfigLoader.Instance.GetJsonKeys())
|
||||
{
|
||||
if (!key.StartsWith("GameBoard"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 提取 boardIndex
|
||||
var boardIndex = 1;
|
||||
var parts = key.Split('_');
|
||||
if (parts.Length > 1 && int.TryParse(parts[1], out var parsed))
|
||||
{
|
||||
boardIndex = parsed;
|
||||
}
|
||||
|
||||
// 获取 json 并反序列化
|
||||
if (ConfigLoader.Instance.TryGetJsonValue(key, out var gameboardJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameBoards = gameboardJson.As<List<GameBoard>>();
|
||||
if (gameBoards != null)
|
||||
{
|
||||
gameConfigModel.game_conf[boardIndex] = gameBoards;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ConfigLoader.Warning($"GameBoard 配置 {key} 反序列化为空");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConfigLoader.Error($"GameBoard 配置 {key} 反序列化失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigLoader.Instance.AddConfig(gameConfigModel);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public static CommonModel GetCommonConf()
|
||||
{
|
||||
return ConfigLoader.Instance.GetConfig<CommonModel>();
|
||||
}
|
||||
|
||||
public static List<T> GetConfig<T>() where T : class
|
||||
{
|
||||
return ConfigLoader.Instance.GetConfig<List<T>>() ?? new List<T>();
|
||||
}
|
||||
|
||||
private static List<T> GetConfigWithOrganicFallback<T, TOrganic>() where T : class
|
||||
{
|
||||
if (GameHelper.IsGiftSwitch() && SuperApplication.Instance.attribution == "organic")
|
||||
{
|
||||
var organicConfig = ConfigLoader.Instance.GetConfig<List<TOrganic>>();
|
||||
if (organicConfig != null)
|
||||
{
|
||||
return organicConfig.Cast<T>().ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return GetConfig<T>();
|
||||
}
|
||||
|
||||
public static List<Live> GetLiveConfig()
|
||||
{
|
||||
return GetConfigWithOrganicFallback<Live, Live_A>();
|
||||
}
|
||||
|
||||
public static List<SecretAlbums> GetSecretAlbumsConfig()
|
||||
{
|
||||
return GetConfigWithOrganicFallback<SecretAlbums, SecretAlbums_A>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +1,101 @@
|
||||
using System;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Common.Extensions;
|
||||
using SGModule.Common.Helper;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace BallKingdomCrush {
|
||||
public class LoginSystem : BaseSystem {
|
||||
private int loginCount = 0;
|
||||
|
||||
private bool _isLogin = false;
|
||||
|
||||
|
||||
private TimerTask timerTask = null;
|
||||
|
||||
public LoginSystem(bool isAutoInit = true) {
|
||||
if (isAutoInit) {
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
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 void RequestLogin(object obj = null) {
|
||||
|
||||
// if (!GameHelper.IsConnect())
|
||||
// {
|
||||
// LoginFail();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (_isLogin) return;
|
||||
_isLogin = true;
|
||||
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginSend);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetworkErrorTipsUI_Open);
|
||||
Log.Info("login request", $"attribution: {SuperApplication.Instance.attribution}, haveSimCard: {NetworkManager.haveSimCard}");
|
||||
LoginKit.Instance.LoginRequest(SuperApplication.Instance.attribution.ToLower(), NetworkManager.haveSimCard, (isSuccess, loginData) => {
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginRecv, isSuccess ? "success" : "fail");
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetworkErrorTipsUI_Close);
|
||||
|
||||
if (isSuccess)
|
||||
{
|
||||
// AB上传 BI
|
||||
BIManager.Instance.TrackABConfig(loginData.IsMagic ? 30 : 15);
|
||||
|
||||
TextureHelper.imgUrl = loginData.CdnURL + "/encrypt/image/";
|
||||
LiveVideoManager.videoBaseUrl = loginData.CdnURL + "/encrypt/video/";
|
||||
|
||||
DateTimeManager.Instance.SetServerCurrTimestamp(loginData.LoginTime);
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||
|
||||
MaxADKit.SetUserID(loginData.Uid.As<string>());
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginFail();
|
||||
}
|
||||
});
|
||||
// }
|
||||
}
|
||||
|
||||
private static void LoginFail()
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
|
||||
void OnFail() {
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
}
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, (Action) OnFail);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using IgnoreOPS;
|
||||
using SGModule.Common.Extensions;
|
||||
using SGModule.Common.Helper;
|
||||
using SGModule.NetKit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BallKingdomCrush {
|
||||
public class LoginSystem : BaseSystem {
|
||||
private int loginCount = 0;
|
||||
|
||||
private bool _isLogin = false;
|
||||
|
||||
|
||||
private TimerTask timerTask = null;
|
||||
|
||||
public LoginSystem(bool isAutoInit = true) {
|
||||
if (isAutoInit) {
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
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 void RequestLogin(object obj = null) {
|
||||
|
||||
// if (!GameHelper.IsConnect())
|
||||
// {
|
||||
// LoginFail();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (_isLogin) return;
|
||||
_isLogin = true;
|
||||
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginSend);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetworkErrorTipsUI_Open);
|
||||
Log.Info("login request", $"attribution: {SuperApplication.Instance.attribution}, haveSimCard: {NetworkManager.haveSimCard}");
|
||||
LoginKit.Instance.LoginRequest(SuperApplication.Instance.attribution.ToLower(), NetworkManager.haveSimCard, (isSuccess, loginData) => {
|
||||
TrackKit.TrackLoginFunnel(LoginFunnelEventType.LoginRecv, isSuccess ? "success" : "fail");
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetworkErrorTipsUI_Close);
|
||||
|
||||
if (isSuccess)
|
||||
{
|
||||
Debug.Log($"loginData.CdnURL======={loginData.CdnURL}");
|
||||
// AB上传 BI
|
||||
BIManager.Instance.TrackABConfig(loginData.IsMagic ? 30 : 15);
|
||||
|
||||
// loginData.CdnURL = "https://asserts.minskyfun.top";
|
||||
|
||||
|
||||
// TextureHelper.imgUrl = loginData.CdnURL + "/encrypt/image/";
|
||||
// LiveVideoManager.videoBaseUrl = loginData.CdnURL + "/encrypt/video/";
|
||||
|
||||
DateTimeManager.Instance.SetServerCurrTimestamp(loginData.LoginTime);
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||
|
||||
MaxADKit.SetUserID(loginData.Uid.As<string>());
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginFail();
|
||||
}
|
||||
});
|
||||
// }
|
||||
}
|
||||
|
||||
private static void LoginFail()
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
|
||||
void OnFail() {
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
}
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, (Action) OnFail);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
base.Dispose();
|
||||
RemoveListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user