From f58d12c2cbba0b52983e9f394de922f5d378ea1b Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 20 Nov 2024 11:25:31 +0800 Subject: [PATCH] [change] refactor code comments and translate them to English --- Editor/Settings/EditorStatusWatcher.cs | 3 --- Editor/Settings/HybridCLRSettingProvider.cs | 1 - Editor/SettingsUtil.cs | 3 --- Runtime/HomologousImageMode.cs | 4 ++-- Runtime/LoadImageErrorCode.cs | 16 +++++++-------- Runtime/RuntimeApi.cs | 22 +++++++++++++++------ 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Editor/Settings/EditorStatusWatcher.cs b/Editor/Settings/EditorStatusWatcher.cs index 0c3865e..986f026 100644 --- a/Editor/Settings/EditorStatusWatcher.cs +++ b/Editor/Settings/EditorStatusWatcher.cs @@ -6,9 +6,6 @@ using UnityEditorInternal; namespace HybridCLR.Editor.Settings { - /// - /// 监听编辑器状态,当编辑器重新 focus 时,重新加载实例,避免某些情景下 svn 、git 等外部修改了数据却无法同步的异常。 - /// [InitializeOnLoad] public static class EditorStatusWatcher { diff --git a/Editor/Settings/HybridCLRSettingProvider.cs b/Editor/Settings/HybridCLRSettingProvider.cs index 43065e6..122187c 100644 --- a/Editor/Settings/HybridCLRSettingProvider.cs +++ b/Editor/Settings/HybridCLRSettingProvider.cs @@ -123,7 +123,6 @@ namespace HybridCLR.Editor.Settings { using (CreateSettingsWindowGUIScope()) { - //解决编辑器打包时出现的 _serializedObject.targetObject 意外销毁的情况 if (_serializedObject == null||!_serializedObject.targetObject) { InitGUI(); diff --git a/Editor/SettingsUtil.cs b/Editor/SettingsUtil.cs index 23d3428..0aaa269 100644 --- a/Editor/SettingsUtil.cs +++ b/Editor/SettingsUtil.cs @@ -65,9 +65,6 @@ namespace HybridCLR.Editor public string name; } - /// - /// 热更新dll列表。不包含 preserveHotUpdateAssemblies。 - /// public static List HotUpdateAssemblyNamesExcludePreserved { get diff --git a/Runtime/HomologousImageMode.cs b/Runtime/HomologousImageMode.cs index dd839ca..f244856 100644 --- a/Runtime/HomologousImageMode.cs +++ b/Runtime/HomologousImageMode.cs @@ -3,8 +3,8 @@ namespace HybridCLR { public enum HomologousImageMode { - Consistent, // AOT dll需要跟主工程精确一致,即为裁剪后的AO dll - SuperSet, // AOT dll不需要跟主工程精确一致,但必须包含裁剪后的AOT dll的所有元数据,即为裁剪后dll的超集。推荐使用原始aot dll + Consistent, + SuperSet, } } diff --git a/Runtime/LoadImageErrorCode.cs b/Runtime/LoadImageErrorCode.cs index 3796004..93d4b38 100644 --- a/Runtime/LoadImageErrorCode.cs +++ b/Runtime/LoadImageErrorCode.cs @@ -4,13 +4,13 @@ namespace HybridCLR public enum LoadImageErrorCode { OK = 0, - BAD_IMAGE, // dll 不合法 - NOT_IMPLEMENT, // 不支持的元数据特性 - AOT_ASSEMBLY_NOT_FIND, // 对应的AOT assembly未找到 - HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // 不能给解释器assembly补充元数据 - HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // 已经补充过了,不能再次补充 - INVALID_HOMOLOGOUS_MODE, // 非法HomologousImageMode - PDB_BAD_FILE, // pdb文件不合法 - }; + BAD_IMAGE, // invalid dll file + NOT_IMPLEMENT, // not implement feature + AOT_ASSEMBLY_NOT_FIND, // AOT assembly not found + HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // can not load supplementary metadata assembly for non-AOT assembly + HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // can not load supplementary metadata assembly for the same assembly + INVALID_HOMOLOGOUS_MODE, // invalid homologous image mode + PDB_BAD_FILE, // invalid pdb file + }; } diff --git a/Runtime/RuntimeApi.cs b/Runtime/RuntimeApi.cs index 1aef7a7..03381b0 100644 --- a/Runtime/RuntimeApi.cs +++ b/Runtime/RuntimeApi.cs @@ -14,7 +14,7 @@ namespace HybridCLR public static class RuntimeApi { /// - /// 加载补充元数据assembly + /// load supplementary metadata assembly /// /// /// @@ -30,7 +30,7 @@ namespace HybridCLR #endif /// - /// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小) + /// get the maximum number of StackObjects in the interpreter thread stack (size*8 represents the final memory size occupied /// /// public static int GetInterpreterThreadObjectStackSize() @@ -39,17 +39,17 @@ namespace HybridCLR } /// - /// 设置解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小) + /// set the maximum number of StackObjects for the interpreter thread stack (size*8 represents the final memory size occupied) /// /// public static void SetInterpreterThreadObjectStackSize(int size) { SetRuntimeOption(RuntimeOptionId.InterpreterThreadObjectStackSize, size); } - + /// - /// 获取解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小) + /// get the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied) /// /// public static int GetInterpreterThreadFrameStackSize() @@ -58,7 +58,7 @@ namespace HybridCLR } /// - /// 设置解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小) + /// set the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied) /// /// public static void SetInterpreterThreadFrameStackSize(int size) @@ -71,6 +71,11 @@ namespace HybridCLR private static readonly Dictionary s_runtimeOptions = new Dictionary(); + /// + /// set runtime option value + /// + /// + /// public static void SetRuntimeOption(RuntimeOptionId optionId, int value) { s_runtimeOptions[optionId] = value; @@ -80,6 +85,11 @@ namespace HybridCLR public static extern void SetRuntimeOption(RuntimeOptionId optionId, int value); #endif + /// + /// get runtime option value + /// + /// + /// #if UNITY_EDITOR public static int GetRuntimeOption(RuntimeOptionId optionId) {