diff --git a/KSFramework/Assets/KSFramework/KEngine/KEngine/CoreModules/SettingModule.cs b/KSFramework/Assets/KSFramework/KEngine/KEngine/CoreModules/SettingModule.cs index 9cf90f20..b572659e 100644 --- a/KSFramework/Assets/KSFramework/KEngine/KEngine/CoreModules/SettingModule.cs +++ b/KSFramework/Assets/KSFramework/KEngine/KEngine/CoreModules/SettingModule.cs @@ -38,19 +38,6 @@ namespace KEngine.Modules /// public class SettingModule : SettingModuleBase { - public delegate byte[] LoadSettingFuncDelegate(string filePath); - public delegate byte[] SettingBytesFilterDelegate(byte[] bytes); - - /// - /// Filter the loaded bytes, which settings file may be encrypted, so you can manipulate the bytes - /// - public static SettingBytesFilterDelegate SettingBytesFilter; - - /// - /// Override the default load file strategy - /// - public static LoadSettingFuncDelegate CustomLoadSetting; - private static readonly bool IsEditor; static SettingModule() { @@ -63,9 +50,8 @@ static SettingModule() internal SettingModule() { } - - - + + /// /// Singleton /// @@ -91,35 +77,16 @@ public static TableFile Get(string path, bool useCache = true) /// protected override string LoadSetting(string path) { - byte[] fileContent = CustomLoadSetting != null ? CustomLoadSetting(path) : DefaultLoadSetting(path); + byte[] fileContent = KResourceModule.LoadAssetsSync(GetSettingFilePath(path)); return Encoding.UTF8.GetString(fileContent); } - - /// - /// Default load setting strategry, - /// - /// - /// - public static byte[] DefaultLoadSetting(string path) - { - string fullUrl ; - var getResPathType = KResourceModule.GetResourceFullPath(GetTextFilePath(path), false, out fullUrl); - if (getResPathType == KResourceModule.GetResourceFullPathType.Invalid) - { - Log.Error("can not find file: {0}", fullUrl); - return null; - } - var bytes = File.ReadAllBytes(fullUrl); - bytes = SettingBytesFilter != null ? SettingBytesFilter(bytes) : bytes; - return bytes; - } - + /// /// 获取配置表的路径,都在Settings目录下 /// /// /// - public static string GetTextFilePath(string path) + public static string GetSettingFilePath(string path) { return AppConfig.SettingResourcesPath + "/" + path; } diff --git a/KSFramework/Assets/KSFramework/Modules/I18N/I18N.cs b/KSFramework/Assets/KSFramework/Modules/I18N/I18N.cs index b5f2e10d..6169ce05 100644 --- a/KSFramework/Assets/KSFramework/Modules/I18N/I18N.cs +++ b/KSFramework/Assets/KSFramework/Modules/I18N/I18N.cs @@ -57,7 +57,7 @@ public static void Init() Strs.Clear(); //读取语言包 var lang_file = $"I18N/lang{AppConfig.LangFileFlag}.txt"; - var bytes = SettingModule.DefaultLoadSetting(lang_file); + var bytes = KResourceModule.LoadAssetsSync(SettingModule.GetSettingFilePath(lang_file)); var fileContent = Encoding.UTF8.GetString(bytes); TextParser.ParseText(fileContent,Strs);