From b5acd02c0c88e6d4b1e77be5e79c97770211539e Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Fri, 5 Aug 2022 11:16:15 +0800 Subject: [PATCH] Update HotUpdate Update HotUpdate --- .../Resources/AssetLoad/UILoadUpdate.prefab | 2 +- .../Runtime/HotUpdate/Runtime/Launcher.cs | 2 ++ .../Runtime/HotUpdate/Runtime/LoadMgr.cs | 17 +++++++++++++++-- .../Runtime/HotUpdate/Runtime/UI/LoadText.cs | 9 +++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Assets/TEngine/Runtime/HotUpdate/Resources/AssetLoad/UILoadUpdate.prefab b/Assets/TEngine/Runtime/HotUpdate/Resources/AssetLoad/UILoadUpdate.prefab index daf70498..04ce2fa7 100644 --- a/Assets/TEngine/Runtime/HotUpdate/Resources/AssetLoad/UILoadUpdate.prefab +++ b/Assets/TEngine/Runtime/HotUpdate/Resources/AssetLoad/UILoadUpdate.prefab @@ -170,7 +170,7 @@ MonoBehaviour: m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: - m_NormalColor: {r: 1, g: 0.90310204, b: 0, a: 1} + m_NormalColor: {r: 0.9716981, g: 0, b: 0.12772757, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} diff --git a/Assets/TEngine/Runtime/HotUpdate/Runtime/Launcher.cs b/Assets/TEngine/Runtime/HotUpdate/Runtime/Launcher.cs index 10c74d77..1fd6f827 100644 --- a/Assets/TEngine/Runtime/HotUpdate/Runtime/Launcher.cs +++ b/Assets/TEngine/Runtime/HotUpdate/Runtime/Launcher.cs @@ -9,9 +9,11 @@ namespace TEngine { public class Launcher:MonoBehaviour { + void Start() { TLogger.Instance.Active(); + LoadMgr.Instance.InitParam("http://1.12.241.46:8081/TXYXGame/",isTestUpdate:true); LoadMgr.Instance.StartLoadInit(LaunchSuccess); } diff --git a/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadMgr.cs b/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadMgr.cs index 4b5371e8..45a1d0b8 100644 --- a/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadMgr.cs +++ b/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadMgr.cs @@ -30,6 +30,8 @@ namespace TEngine public class LoadMgr : TSingleton { + private bool _isTestUpdate = false; + /// /// 资源版本号 /// @@ -63,6 +65,12 @@ namespace TEngine return _instance._loaderUpdateLaunched; } + public void InitParam(string url,bool isTestUpdate = false) + { + Url = url; + _isTestUpdate = isTestUpdate; + } + public void StartLoadInit(Action onUpdateComplete) { //热更新阶段文本初始化 @@ -81,6 +89,11 @@ namespace TEngine #if RELEASE_BUILD || _DEVELOPMENT_BUILD_ StartLoad(() => { FinishCallBack(onUpdateComplete); }); #else + if (_isTestUpdate) + { + StartLoad(() => { FinishCallBack(onUpdateComplete); }); + return; + } onUpdateComplete?.Invoke(); #endif } @@ -139,7 +152,7 @@ namespace TEngine } UILoadMgr.Show(UIDefine.UILoadUpdate, string.Format(LoadText.Instance.Label_Load_Checking, _curTryCount)); - if (string.IsNullOrEmpty(OnlineParamUrl)) + if (string.IsNullOrEmpty(Url) || string.IsNullOrEmpty(OnlineParamUrl)) { TLogger.LogError("LoadMgr.RequestVersion, remote url is empty or null"); LoaderUtilities.ShowMessageBox(LoadText.Instance.Label_RemoteUrlisNull, MessageShowType.OneButton, @@ -511,7 +524,7 @@ namespace TEngine private string _resListUrl = string.Empty; private string _onlineParamUrl = string.Empty; - internal const string Url = "http://1.12.241.46:8081/TXYXGame/"; + internal string Url = string.Empty; internal string ResListUrl { diff --git a/Assets/TEngine/Runtime/HotUpdate/Runtime/UI/LoadText.cs b/Assets/TEngine/Runtime/HotUpdate/Runtime/UI/LoadText.cs index d0ef23e5..878164e2 100644 --- a/Assets/TEngine/Runtime/HotUpdate/Runtime/UI/LoadText.cs +++ b/Assets/TEngine/Runtime/HotUpdate/Runtime/UI/LoadText.cs @@ -39,7 +39,7 @@ namespace TEngine.UI public string Label_DownLoadFailed = "网络太慢,是否继续下载"; public string Label_ClearConfig = "清除环境配置,需要重启应用"; public string Label_RegionInfoIllegal = "区服信息为空"; - public string Label_RemoteUrlisNull = "热更新服地址为空"; + public string Label_RemoteUrlisNull = "热更地址为空"; public string Label_FirstPackageNotFound = "首包资源加载失败"; public string Label_RequestReginInfo = "正在请求区服信息{0}次"; public string Label_RequestTimeOut = "请求区服信息超时,是否重试?"; @@ -57,18 +57,19 @@ namespace TEngine.UI public string Label_Dlc_ConfigLoadingStage = "下载配置中..."; public string Label_Dlc_AssetsLoading = "下载资源中..."; public string Label_Dlc_LoadingFinish = "下载结束"; - + public string Label_Dlc_Load_Force_WIFI = "检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,您当前已为wifi网络,请开始更新"; public string Label_Dlc_Load_Force_NO_WIFI = "检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,请开始更新"; } - public class LoadText: TextMode + public class LoadText : TextMode { private static LoadText _instance; - public static LoadText Instance { + public static LoadText Instance + { get { return _instance ?? (_instance = new LoadText()); } }