diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Localization/Localization.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Localization/Localization.cs index 32206e50..98e2f4df 100644 --- a/UnityProject/Assets/Dependencies/JEngine/Core/Localization/Localization.cs +++ b/UnityProject/Assets/Dependencies/JEngine/Core/Localization/Localization.cs @@ -161,17 +161,18 @@ public static string GetString(string key) Init(); } - if (_phrases != null && !_phrases.TryGetValue(_language,out var dic)) + if (_phrases != null && !_phrases.ContainsKey(_language)) { - string newLang = _phrases.Keys.ToList().Find(k => k.Split('-')[0] == _language.Split('-')[0]); + string newLang = _phrases.Keys.ToList().Find(k => k.StartsWith($"{_language.Split('-')[0]}-")); if (_language != "zh-cn" && newLang == null) { newLang = "zh-cn"; } - else + else if (newLang == null) { - return $"[invalid language: {_language}]";; + return $"[invalid language: {_language}]"; } + Log.PrintError($"不存在语言{_language},自动替换为{newLang}"); ChangeLanguage(newLang); } diff --git a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll index f34bb6f5..6861725e 100644 Binary files a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll and b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.dll differ diff --git a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb index 7403074e..12d166ca 100644 Binary files a/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb and b/UnityProject/Assets/HotUpdateResources/Dll/Hidden~/HotUpdateScripts.pdb differ diff --git a/UnityProject/HotUpdateScripts/HotUpdateScripts.csproj b/UnityProject/HotUpdateScripts/HotUpdateScripts.csproj index 281c6d89..d79d9d38 100644 --- a/UnityProject/HotUpdateScripts/HotUpdateScripts.csproj +++ b/UnityProject/HotUpdateScripts/HotUpdateScripts.csproj @@ -47,7 +47,6 @@ - diff --git a/UnityProject/HotUpdateScripts/JEngine/Core/JResource.cs b/UnityProject/HotUpdateScripts/JEngine/Core/JResource.cs deleted file mode 100644 index f930e28f..00000000 --- a/UnityProject/HotUpdateScripts/JEngine/Core/JResource.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// JResource.cs -// -// Author: -// JasonXuDeveloper(傑) -// -// Copyright (c) 2020 JEngine -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; - -namespace JEngine.Core -{ - public class JResource - { - /// - /// 加载热更资源(请使用全路径) - /// Load hot update resource - /// - /// - /// - /// - /// - public static T LoadRes(string path, string package) where T : UnityEngine.Object - { - return AssetMgr.Load(path, package, typeof(T)); - } - - /// - /// 卸载热更资源 - /// Load hot update resource - /// - /// - /// - /// - public static void UnloadRes(string path, string package) - { - AssetMgr.Unload(path, package); - } - - /// - /// 异步并行加载热更资源(可加回调) - /// Load hot update resource async but parallel (can add callback) - /// - /// - /// - /// - /// - public static async void LoadResAsync(string path, Action callback) where T : UnityEngine.Object - { - var asset = await AssetMgr.LoadAsync(path, typeof(T)); - callback?.Invoke(asset); - } - - /// - /// 场景加载的进度 - /// Progress of loading a scene - /// - public static float LoadSceneProgress; - - /// - /// 异步并行加载场景(可加回调) - /// Load hot update scene async but parallel (can add callback) - /// - /// - /// - /// - /// - /// - public static void LoadSceneAsync(string path, string package = null, Action loading = null, Action finished = null, bool additive = false) - { - AssetMgr.LoadSceneAsync(path, additive, package, (p) => - { - loading?.Invoke(p); - LoadSceneProgress = p; - }, (b) => - { - finished?.Invoke(); - LoadSceneProgress = 1; - }); - } - } -}