From 9033d5abffd9f9e9e8804a39a40859d817a57b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Fri, 7 Mar 2025 18:00:59 +0800 Subject: [PATCH] modify --- Client/Assets/Resources/AssemblyLoadData.json | 1 + ....asset.meta => AssemblyLoadData.json.meta} | 5 +- .../FrameworkHotUpdateSettings.asset | 30 --- .../Resources/FrameworkPublishSettings.asset | 24 --- ...PublishSettings.asset.meta => Scenes.meta} | 6 +- Client/Assets/{ => Scenes}/Main.unity | 0 Client/Assets/{ => Scenes}/Main.unity.meta | 0 .../Editor/Alicizax.Editor.Entension.asmdef | 3 +- Client/Assets/Scripts/Editor/Base.meta | 3 + .../Scripts/Editor/Base/EditorToolBase.cs | 16 ++ .../Editor/Base/EditorToolBase.cs.meta | 3 + .../Base/EditorToolFunctionAttribute.cs | 92 +++++++++ .../Base/EditorToolFunctionAttribute.cs.meta | 3 + .../Build/BuildWindow/AdvancedBuildWindow.cs | 1 - .../Postprocessor/Atlas/AtlasEditorWindow.cs | 3 +- .../Editor/ToolBar/BuildSettingWindow.cs | 25 +++ .../Editor/ToolBar/BuildSettingWindow.cs.meta | 3 + .../Editor/ToolBar/EditorQuickToolBar.cs | 62 ++++++ .../Editor/ToolBar/EditorQuickToolBar.cs.meta | 3 + .../Editor/ToolBar/OfflinePlayModeToolBar.cs | 18 -- .../ToolBar/OfflinePlayModeToolBar.cs.meta | 3 - .../ToolBar/ResourceModeDropdownField.cs | 50 ++++- .../Editor/ToolBar/SwitchSceneToolBar.cs | 101 +++++++++ .../Editor/ToolBar/SwitchSceneToolBar.cs.meta | 3 + .../Scripts/Startup/Framework/GlobalConfig.cs | 6 - .../Startup/Framework/GlobalSetting.cs | 9 + ...alConfig.cs.meta => GlobalSetting.cs.meta} | 0 .../PatchUpdater/ProcedurePatchInit.cs | 2 +- .../ProcedureGetAppVersionInfoState.cs | 6 +- .../Procedure/ProcedureGetGlobalInfoState.cs | 2 +- .../Procedure/ProcedureLoadAssembly.cs | 71 ++++--- Client/Assets/Test/GameBase.dll.bytes | Bin 4608 -> 4608 bytes Client/Assets/Test/GameBase.pdb.bytes | Bin 20124 -> 20136 bytes Client/Assets/Test/GameLib.dll.bytes | Bin 4608 -> 4608 bytes Client/Assets/Test/GameLib.pdb.bytes | Bin 20036 -> 20048 bytes Client/Assets/Test/GameLogic.dll.bytes | Bin 11264 -> 11264 bytes Client/Assets/Test/GameLogic.pdb.bytes | Bin 23024 -> 23036 bytes Client/Assets/Test/GameProto.dll.bytes | Bin 24064 -> 24064 bytes Client/Assets/Test/GameProto.pdb.bytes | Bin 29240 -> 29248 bytes .../UISettingEditorWindow.cs} | 47 +++-- .../UISettingEditorWindow.cs.meta | 3 + .../UIConfig/UIGenerateConfiguration.cs | 4 +- .../UIGenerateConfigurationTab.cs.meta | 3 - .../com.alicizax.unity.ui/package.json | 2 +- .../Constant/FrameworkAssetInitlized.cs | 36 ---- .../Constant/FrameworkAssetInitlized.cs.meta | 3 - .../GameFrameworkPreferenceWindow.cs | 194 +++++++++--------- .../Editor/HybridCLR/BuildDLLCommand.cs | 17 +- .../Editor/HybridCLR/HybridCLRSettingTab.cs | 37 ---- .../HybridCLR/HybridCLRSettingTab.cs.meta | 3 - .../Editor/HybridCLR/SynAssemblysContent.cs | 11 +- .../Runtime/Constant/AppBuilderSetting.cs | 29 +++ ...ings.cs.meta => AppBuilderSetting.cs.meta} | 0 .../Runtime/Constant/AssemblyLoadData.cs | 46 +++++ ...tings.cs.meta => AssemblyLoadData.cs.meta} | 0 .../Constant/FrameworkHotUpdateSettings.cs | 44 ---- .../Constant/FrameworkPublishSettings.cs | 15 -- .../Constant/FrameworkSettingsUtils.cs | 38 ---- .../Constant/FrameworkSettingsUtils.cs.meta | 3 - Client/Packages/manifest.json | 2 +- Client/Packages/packages-lock.json | 2 +- .../ProjectSettings/EditorBuildSettings.asset | 2 +- Client/UserSettings/Layouts/default-6000.dwlt | 24 +-- 63 files changed, 657 insertions(+), 462 deletions(-) create mode 100644 Client/Assets/Resources/AssemblyLoadData.json rename Client/Assets/Resources/{FrameworkHotUpdateSettings.asset.meta => AssemblyLoadData.json.meta} (52%) delete mode 100644 Client/Assets/Resources/FrameworkHotUpdateSettings.asset delete mode 100644 Client/Assets/Resources/FrameworkPublishSettings.asset rename Client/Assets/{Resources/FrameworkPublishSettings.asset.meta => Scenes.meta} (52%) rename Client/Assets/{ => Scenes}/Main.unity (100%) rename Client/Assets/{ => Scenes}/Main.unity.meta (100%) create mode 100644 Client/Assets/Scripts/Editor/Base.meta create mode 100644 Client/Assets/Scripts/Editor/Base/EditorToolBase.cs create mode 100644 Client/Assets/Scripts/Editor/Base/EditorToolBase.cs.meta create mode 100644 Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs create mode 100644 Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs.meta create mode 100644 Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs create mode 100644 Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs.meta create mode 100644 Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs create mode 100644 Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs.meta delete mode 100644 Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs delete mode 100644 Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs.meta create mode 100644 Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs create mode 100644 Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs.meta delete mode 100644 Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs create mode 100644 Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs rename Client/Assets/Scripts/Startup/Framework/{GlobalConfig.cs.meta => GlobalSetting.cs.meta} (100%) rename Client/Packages/com.alicizax.unity.ui/Editor/{UIConfig/UIGenerateConfigurationTab.cs => GenerateTool/UISettingEditorWindow.cs} (75%) create mode 100644 Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs.meta delete mode 100644 Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs.meta delete mode 100644 Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs delete mode 100644 Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs.meta delete mode 100644 Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs delete mode 100644 Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs.meta create mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs rename Client/Packages/com.alicizax.unity/Runtime/Constant/{FrameworkPublishSettings.cs.meta => AppBuilderSetting.cs.meta} (100%) create mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs rename Client/Packages/com.alicizax.unity/Runtime/Constant/{FrameworkHotUpdateSettings.cs.meta => AssemblyLoadData.cs.meta} (100%) delete mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs delete mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs delete mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs delete mode 100644 Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs.meta diff --git a/Client/Assets/Resources/AssemblyLoadData.json b/Client/Assets/Resources/AssemblyLoadData.json new file mode 100644 index 0000000..0920b42 --- /dev/null +++ b/Client/Assets/Resources/AssemblyLoadData.json @@ -0,0 +1 @@ +{"HotUpdateAssemblies":["GameLib.dll","GameProto.dll","GameBase.dll","GameLogic.dll"],"AOTMetaAssemblies":["mscorlib.dll","System.dll","System.Core.dll","UnityEngine.CoreModule.dll","YooAsset.dll","UniTask.Runtime.dll","ZString.dll"]} \ No newline at end of file diff --git a/Client/Assets/Resources/FrameworkHotUpdateSettings.asset.meta b/Client/Assets/Resources/AssemblyLoadData.json.meta similarity index 52% rename from Client/Assets/Resources/FrameworkHotUpdateSettings.asset.meta rename to Client/Assets/Resources/AssemblyLoadData.json.meta index 299e7f2..e3eece5 100644 --- a/Client/Assets/Resources/FrameworkHotUpdateSettings.asset.meta +++ b/Client/Assets/Resources/AssemblyLoadData.json.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: efd2da5560bdcde42a91ff632fccad20 -NativeFormatImporter: +guid: 69d8fe4890823d140950a9c8adce8ff8 +TextScriptImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Client/Assets/Resources/FrameworkHotUpdateSettings.asset b/Client/Assets/Resources/FrameworkHotUpdateSettings.asset deleted file mode 100644 index d2fbaf4..0000000 --- a/Client/Assets/Resources/FrameworkHotUpdateSettings.asset +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7c0f00a264c34df985e6c6b6e3f8b353, type: 3} - m_Name: FrameworkHotUpdateSettings - m_EditorClassIdentifier: - HotUpdateAssemblies: - - GameLib.dll - - GameProto.dll - - GameBase.dll - - GameLogic.dll - AOTMetaAssemblies: - - mscorlib.dll - - System.dll - - System.Core.dll - - UnityEngine.CoreModule.dll - - YooAsset.dll - - UniTask.Runtime.dll - - ZString.dll - LogicMainDllName: GameLogic.dll - AssemblyTextAssetExtension: .bytes - AssemblyTextAssetPath: AssetRaw/DLL diff --git a/Client/Assets/Resources/FrameworkPublishSettings.asset b/Client/Assets/Resources/FrameworkPublishSettings.asset deleted file mode 100644 index 80025a7..0000000 --- a/Client/Assets/Resources/FrameworkPublishSettings.asset +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7f734b9c80c9475690a0edad9a7626bd, type: 3} - m_Name: FrameworkPublishSettings - m_EditorClassIdentifier: - Configs: - - Version_Type: Release - CheckUrl: http://127.0.0.1:8080/UpdateData.json - - Version_Type: Dev - CheckUrl: http://127.0.0.1:8080/UpdateData.json - - Version_Type: Test - CheckUrl: http://127.0.0.1:8080/UpdateData.json - AppStageType: Dev - ResMode: 2 - Language: 1 diff --git a/Client/Assets/Resources/FrameworkPublishSettings.asset.meta b/Client/Assets/Scenes.meta similarity index 52% rename from Client/Assets/Resources/FrameworkPublishSettings.asset.meta rename to Client/Assets/Scenes.meta index 54ee0f0..4dd10e7 100644 --- a/Client/Assets/Resources/FrameworkPublishSettings.asset.meta +++ b/Client/Assets/Scenes.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: db8426664259b2946b313fa434c0e847 -NativeFormatImporter: +guid: ac7f00f949ed1764db4176b08446dac4 +folderAsset: yes +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Client/Assets/Main.unity b/Client/Assets/Scenes/Main.unity similarity index 100% rename from Client/Assets/Main.unity rename to Client/Assets/Scenes/Main.unity diff --git a/Client/Assets/Main.unity.meta b/Client/Assets/Scenes/Main.unity.meta similarity index 100% rename from Client/Assets/Main.unity.meta rename to Client/Assets/Scenes/Main.unity.meta diff --git a/Client/Assets/Scripts/Editor/Alicizax.Editor.Entension.asmdef b/Client/Assets/Scripts/Editor/Alicizax.Editor.Entension.asmdef index a625fe2..e170a3e 100644 --- a/Client/Assets/Scripts/Editor/Alicizax.Editor.Entension.asmdef +++ b/Client/Assets/Scripts/Editor/Alicizax.Editor.Entension.asmdef @@ -7,7 +7,8 @@ "GUID:df8e45d6cf544f2693a36da8779a9fc9", "GUID:8d62da4aabd2a19419c7378d23ea5849", "GUID:acfef7cabed3b0a42b25edb1cd4fa259", - "GUID:be2f20a77f3232f44b9711ef43234aac" + "GUID:be2f20a77f3232f44b9711ef43234aac", + "GUID:75b6f2078d190f14dbda4a5b747d709c" ], "includePlatforms": [ "Editor" diff --git a/Client/Assets/Scripts/Editor/Base.meta b/Client/Assets/Scripts/Editor/Base.meta new file mode 100644 index 0000000..c6785c2 --- /dev/null +++ b/Client/Assets/Scripts/Editor/Base.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bc3f948f15304085b3623e95529402b2 +timeCreated: 1741335009 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs b/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs new file mode 100644 index 0000000..4d3d0d0 --- /dev/null +++ b/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs @@ -0,0 +1,16 @@ +using UnityEditor; +using UnityEngine; + +namespace AlicizaX.Editor.Extension +{ + public abstract class EditorToolBase : EditorWindow + { + public abstract string ToolName { get; } + public abstract Vector2Int WinSize { get; } + private void Awake() + { + this.titleContent = new GUIContent(ToolName); + this.position.Set(this.position.x, this.position.y, this.WinSize.x, this.WinSize.y); + } + } +} diff --git a/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs.meta b/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs.meta new file mode 100644 index 0000000..f251de7 --- /dev/null +++ b/Client/Assets/Scripts/Editor/Base/EditorToolBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c5059ae8ffe14e83adc79687bb2f6128 +timeCreated: 1741335011 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs b/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs new file mode 100644 index 0000000..203b10c --- /dev/null +++ b/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace AlicizaX.Editor.Extension +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + public class EditorToolFunctionAttribute : Attribute + { + public string ToolMenuPath { get; private set; } + public int MenuOrder { get; private set; } + public Type OwnerType { get; private set; } + public MethodInfo MethodInfo { get; private set; } + + public EditorToolFunctionAttribute(string menu, Type owner, int menuOrder = 0) + { + this.ToolMenuPath = menu; + OwnerType = owner; + MenuOrder = menuOrder; + } + + public void SetMethodInfo(MethodInfo methodInfo) + { + MethodInfo = methodInfo; + } + } + + internal static class EditorToolFunctionAttributeCollector + { + public static List Attributes = new List(); + + public static void Register(EditorToolFunctionAttribute attribute) + { + Attributes.Add(attribute); + Attributes.Sort((x, y) => x.MenuOrder.CompareTo(y.MenuOrder)); + } + + /// + /// 扫描所有程序集中的类和方法,自动注册带有 EditorToolFunctionAttribute 的方法。 + /// + [InitializeOnLoadMethod] + public static void ScanAndRegisterAllMethods() + { + // 获取当前应用程序域中的所有程序集 + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + + foreach (var assembly in assemblies) + { + try + { + // 获取程序集中的所有类型 + var types = assembly.GetTypes(); + + foreach (var type in types) + { + try + { + // 获取类型中的所有方法 + var methods = + type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + + foreach (var method in methods) + { + // 检查方法是否带有 EditorToolFunctionAttribute + var attribute = method.GetCustomAttribute(); + if (attribute != null) + { + // 设置方法的 MethodInfo + attribute.SetMethodInfo(method); + Register(attribute); + } + } + } + catch (Exception ex) + { + Debug.LogError($"Failed to process type {type.FullName}: {ex.Message}"); + } + } + } + catch (Exception ex) + { + Debug.LogError($"Failed to process assembly {assembly.FullName}: {ex.Message}"); + } + } + + // Debug.Log($"Registered {Attributes.Count} methods with EditorToolFunctionAttribute."); + } + } +} diff --git a/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs.meta b/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs.meta new file mode 100644 index 0000000..a35c300 --- /dev/null +++ b/Client/Assets/Scripts/Editor/Base/EditorToolFunctionAttribute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aea4eaf9f6aa4109bb9a01f4537ee060 +timeCreated: 1741335052 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/Build/BuildWindow/AdvancedBuildWindow.cs b/Client/Assets/Scripts/Editor/Build/BuildWindow/AdvancedBuildWindow.cs index 7210171..c75f1b6 100644 --- a/Client/Assets/Scripts/Editor/Build/BuildWindow/AdvancedBuildWindow.cs +++ b/Client/Assets/Scripts/Editor/Build/BuildWindow/AdvancedBuildWindow.cs @@ -16,7 +16,6 @@ public class AdvancedBuildWindow : EditorWindow private Vector2 _scrollPosition; private EditorWindowTabBase showTab; - [MenuItem("开发工具/打包工具")] public static void ShowWindow() { GetWindow("Build Window", true); diff --git a/Client/Assets/Scripts/Editor/Postprocessor/Atlas/AtlasEditorWindow.cs b/Client/Assets/Scripts/Editor/Postprocessor/Atlas/AtlasEditorWindow.cs index c4e0537..a6e9de8 100644 --- a/Client/Assets/Scripts/Editor/Postprocessor/Atlas/AtlasEditorWindow.cs +++ b/Client/Assets/Scripts/Editor/Postprocessor/Atlas/AtlasEditorWindow.cs @@ -1,5 +1,6 @@ // AtlasEditorWindow.cs +using AlicizaX.Editor.Extension; using UnityEditor; using UnityEngine; @@ -8,7 +9,7 @@ public class AtlasEditorWindow : EditorWindow private AtlasConfiguration config; private Vector2 scrollPos; - [MenuItem("开发工具/Atlas Tool")] + [EditorToolFunction("图集工具",typeof(AtlasEditorWindow))] public static void ShowWindow() { GetWindow("图集打包"); diff --git a/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs b/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs new file mode 100644 index 0000000..881f3ef --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs @@ -0,0 +1,25 @@ +using Paps.UnityToolbarExtenderUIToolkit; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; + +[MainToolbarElement(id: "BuildSettingWindow", alignment: ToolbarAlign.Right, order: 1)] +public class BuildSettingWindow : IMGUIContainer +{ + private GUIContent buildBtContent; + public void InitializeElement() + { + buildBtContent = EditorGUIUtility.TrTextContentWithIcon("Build App/Hotfix", "打新包/打热更", EditorGUIUtility.IconContent("d_BuildSettings.Standalone").image); + onGUIHandler = MyGUIMethod; + } + + private void MyGUIMethod() + { + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(buildBtContent, EditorStyles.toolbarButton, GUILayout.MaxWidth(125))) + Debug.Log("GUI Button clicked"); + + GUILayout.EndHorizontal(); + } +} diff --git a/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs.meta b/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs.meta new file mode 100644 index 0000000..225f498 --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/BuildSettingWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: af03d991c6e34e8bbfbf861b558aa11b +timeCreated: 1741240351 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs b/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs new file mode 100644 index 0000000..6020245 --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Paps.UnityToolbarExtenderUIToolkit; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; + +namespace AlicizaX.Editor.Extension +{ + [MainToolbarElement("EditorQuickToolBar", alignment: ToolbarAlign.Right, order: 0)] + public class EditorQuickToolBar : IMGUIContainer + { + private static GUIContent toolsDropBtContent; + + public void InitializeElement() + { + toolsDropBtContent = EditorGUIUtility.TrTextContentWithIcon("Tools", "工具箱", "CustomTool"); + onGUIHandler = MyGUIMethod; + } + + private void MyGUIMethod() + { + GUILayout.BeginHorizontal(); + if (EditorGUILayout.DropdownButton(toolsDropBtContent, FocusType.Passive, EditorStyles.toolbarPopup, + GUILayout.MaxWidth(90))) + { + DrawEditorToolDropdownMenus(); + } + + GUILayout.Space(5); + GUILayout.EndHorizontal(); + } + + static void DrawEditorToolDropdownMenus() + { + GenericMenu popMenu = new GenericMenu(); + for (int i = 0; i < EditorToolFunctionAttributeCollector.Attributes.Count; i++) + { + var toolAttr = EditorToolFunctionAttributeCollector.Attributes[i]; + popMenu.AddItem(new GUIContent(toolAttr.ToolMenuPath), false, + menuIdx => { ClickToolsSubmenu((int)menuIdx); }, i); + } + + popMenu.ShowAsContext(); + } + + static void ClickToolsSubmenu(int menuIdx) + { + var editorTp = EditorToolFunctionAttributeCollector.Attributes[menuIdx]; + if (editorTp.MethodInfo != null && editorTp.MethodInfo.IsStatic) + { + editorTp.MethodInfo.Invoke(null, null); // Invoke the static method + } + else + { + Debug.LogError("Method is not static or not found."); + } + } + } +} diff --git a/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs.meta b/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs.meta new file mode 100644 index 0000000..b2a2a22 --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/EditorQuickToolBar.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6862584178a44687ab6912b5bbac36b4 +timeCreated: 1741334878 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs b/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs deleted file mode 100644 index 1cb6d0e..0000000 --- a/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Paps.UnityToolbarExtenderUIToolkit; -using UnityEngine; -using UnityEngine.UIElements; - - -namespace AlicizaX.Editor.Extension -{ - [MainToolbarElement(id: "OfflinePlayModeToolBar", alignment: ToolbarAlign.Left, order: 0)] - public class OfflinePlayModeToolBar : Button - { - public void InitializeElement() - { - text = "G"; - style.fontSize = 14; - tooltip = ""; - } - } -} diff --git a/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs.meta b/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs.meta deleted file mode 100644 index 861b671..0000000 --- a/Client/Assets/Scripts/Editor/ToolBar/OfflinePlayModeToolBar.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1ff74180b05648269a06f3de75428b13 -timeCreated: 1741065566 \ No newline at end of file diff --git a/Client/Assets/Scripts/Editor/ToolBar/ResourceModeDropdownField.cs b/Client/Assets/Scripts/Editor/ToolBar/ResourceModeDropdownField.cs index 3526438..3324846 100644 --- a/Client/Assets/Scripts/Editor/ToolBar/ResourceModeDropdownField.cs +++ b/Client/Assets/Scripts/Editor/ToolBar/ResourceModeDropdownField.cs @@ -3,14 +3,17 @@ using System.Linq; using AlicizaX.Resource.Runtime; using Paps.UnityToolbarExtenderUIToolkit; using UnityEditor; +using UnityEditor.Toolbars; using UnityEngine; using UnityEngine.UIElements; namespace AlicizaX.Editor.Extension { [MainToolbarElement("ResourceModeDropdownField", alignment: ToolbarAlign.Right, order: 0)] - public class ResourceModeDropdownField : DropdownField + public class ResourceModeDropdownField : IMGUIContainer { + private static GUIContent appConfigBtContent; + private static readonly string[] _resourceModeNames = { "Editor", @@ -20,16 +23,43 @@ namespace AlicizaX.Editor.Extension public void InitializeElement() { - label = ""; - choices = _resourceModeNames.ToList(); - style.fontSize = 12; - int index = EditorPrefs.GetInt(ResourceComponent.PrefsKey, 0); - SetValueWithoutNotify(choices[index]); - RegisterCallback>(evt => + appConfigBtContent = + EditorGUIUtility.TrTextContentWithIcon("Res:", "配置App运行时所需DataTable/Config/Procedure", + "Settings"); + onGUIHandler = MyGUIMethod; + } + + private void MyGUIMethod() + { + GUILayout.BeginHorizontal(); + string title = "Res:" + _resourceModeNames[EditorPrefs.GetInt(ResourceComponent.PrefsKey, 0)]; + appConfigBtContent.text = title; + if (EditorGUILayout.DropdownButton(appConfigBtContent, FocusType.Passive, EditorStyles.toolbarPopup, GUILayout.MaxWidth(90))) { - int newIndex = _resourceModeNames.ToList().IndexOf(evt.newValue); - EditorPrefs.SetInt(ResourceComponent.PrefsKey, newIndex); - }); + DrawEditorToolDropdownMenus(); + } + + GUILayout.Space(5); + GUILayout.EndHorizontal(); + } + + static void DrawEditorToolDropdownMenus() + { + int index = EditorPrefs.GetInt(ResourceComponent.PrefsKey, 0); + GenericMenu popMenu = new GenericMenu(); + for (int i = 0; i < _resourceModeNames.Length; i++) + { + var selected = index == i; + var toolAttr = _resourceModeNames[i]; + popMenu.AddItem(new GUIContent(toolAttr), selected, menuIdx => { ClickToolsSubmenu((int)menuIdx); }, i); + } + + popMenu.ShowAsContext(); + } + + static void ClickToolsSubmenu(int menuIdx) + { + EditorPrefs.SetInt(ResourceComponent.PrefsKey, menuIdx); } } } diff --git a/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs b/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs new file mode 100644 index 0000000..f0631ed --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs @@ -0,0 +1,101 @@ +using System.Collections.Generic; +using Paps.UnityToolbarExtenderUIToolkit; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.UIElements; + +[MainToolbarElement(id: "SwitchSceneToolBar", alignment: ToolbarAlign.Left, order: 1)] +public class SwitchSceneToolBar : IMGUIContainer +{ + private GUIContent switchSceneBtContent; + + public void InitializeElement() + { + var curOpenSceneName = EditorSceneManager.GetActiveScene().name; + switchSceneBtContent = EditorGUIUtility.TrTextContentWithIcon( + string.IsNullOrEmpty(curOpenSceneName) ? "Switch Scene" : curOpenSceneName, "切换场景", "UnityLogo"); + onGUIHandler = MyGUIMethod; + EditorSceneManager.sceneOpened += OnSceneOpened; + } + + private void OnSceneOpened(Scene scene, OpenSceneMode mode) + { + switchSceneBtContent.text = scene.name; + } + + private static List sceneAssetList = new List(); + + private void MyGUIMethod() + { + GUILayout.BeginHorizontal(); + + if (EditorGUILayout.DropdownButton(switchSceneBtContent, FocusType.Passive, EditorStyles.toolbarPopup, + GUILayout.MaxWidth(150))) + { + DrawSwithSceneDropdownMenus(); + } + + GUILayout.EndHorizontal(); + } + + static string[] ScenePath = new[] { "Assets/Bundles/Scenes/", "Assets/Scenes/" }; + private static string RootScenePath = "Assets/Bundles/Scenes/"; + private static string BundleScenePath = "Assets/Scenes/"; + + static void DrawSwithSceneDropdownMenus() + { + GenericMenu popMenu = new GenericMenu(); + popMenu.allowDuplicateNames = true; + var sceneGuids = AssetDatabase.FindAssets("t:Scene", ScenePath); + sceneAssetList.Clear(); + for (int i = 0; i < sceneGuids.Length; i++) + { + var scenePath = AssetDatabase.GUIDToAssetPath(sceneGuids[i]); + sceneAssetList.Add(scenePath); + string fileDir = System.IO.Path.GetDirectoryName(scenePath); + bool isInRootDir = AlicizaX.Runtime.Utility.Path.GetRegularPath(BundleScenePath).TrimEnd('/') == + AlicizaX.Runtime.Utility.Path.GetRegularPath(fileDir).TrimEnd('/'); + var sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePath); + string displayName = sceneName; + if (!isInRootDir) + { + var sceneDir = System.IO.Path.GetRelativePath(RootScenePath, fileDir); + displayName = $"{sceneDir}/{sceneName}"; + } + + popMenu.AddItem(new GUIContent(displayName), false, menuIdx => { SwitchScene((int)menuIdx); }, i); + } + + popMenu.ShowAsContext(); + } + + private static void SwitchScene(int menuIdx) + { + if (menuIdx >= 0 && menuIdx < sceneAssetList.Count) + { + var scenePath = sceneAssetList[menuIdx]; + var curScene = EditorSceneManager.GetActiveScene(); + if (curScene != null && curScene.isDirty) + { + int opIndex = + EditorUtility.DisplayDialogComplex("警告", $"当前场景{curScene.name}未保存,是否保存?", "保存", "取消", "不保存"); + switch (opIndex) + { + case 0: + if (!EditorSceneManager.SaveOpenScenes()) + { + return; + } + + break; + case 1: + return; + } + } + + EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single); + } + } +} diff --git a/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs.meta b/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs.meta new file mode 100644 index 0000000..58bf986 --- /dev/null +++ b/Client/Assets/Scripts/Editor/ToolBar/SwitchSceneToolBar.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 558a3f0219eb4dc498ca3ef90446af34 +timeCreated: 1741329998 \ No newline at end of file diff --git a/Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs b/Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs deleted file mode 100644 index 21ebf5e..0000000 --- a/Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs +++ /dev/null @@ -1,6 +0,0 @@ -using AlicizaX.Resource.Runtime; - -public static class GlobalConfig -{ - public static ResourcePatchData PatchData; -} \ No newline at end of file diff --git a/Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs b/Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs new file mode 100644 index 0000000..98417c0 --- /dev/null +++ b/Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs @@ -0,0 +1,9 @@ +using AlicizaX.Resource.Runtime; + +public static class GlobalSetting +{ + public static ResourcePatchData PatchData; + public const string EntranceDll = "GameLogic.dll"; + public const string EntranceClass = "GameLogic.HotfixEntry"; + public const string EntranceMethod = "Entrance"; +} diff --git a/Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs.meta b/Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs.meta similarity index 100% rename from Client/Assets/Scripts/Startup/Framework/GlobalConfig.cs.meta rename to Client/Assets/Scripts/Startup/Framework/GlobalSetting.cs.meta diff --git a/Client/Assets/Scripts/Startup/Framework/Procedure/PatchUpdater/ProcedurePatchInit.cs b/Client/Assets/Scripts/Startup/Framework/Procedure/PatchUpdater/ProcedurePatchInit.cs index 1f00d92..697a5ab 100644 --- a/Client/Assets/Scripts/Startup/Framework/Procedure/PatchUpdater/ProcedurePatchInit.cs +++ b/Client/Assets/Scripts/Startup/Framework/Procedure/PatchUpdater/ProcedurePatchInit.cs @@ -32,7 +32,7 @@ namespace Unity.Startup.Procedure async void Start(IFsm procedureOwner) { - string bundleUrl = GlobalConfig.PatchData.BundleUrl; + string bundleUrl = GlobalSetting.PatchData.BundleUrl; Log.Info("下载资源的路径:" + bundleUrl); await GameApp.Resource.InitPackageAsync(string.Empty, bundleUrl, bundleUrl, true); diff --git a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetAppVersionInfoState.cs b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetAppVersionInfoState.cs index 593d858..db3b203 100644 --- a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetAppVersionInfoState.cs +++ b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetAppVersionInfoState.cs @@ -32,16 +32,16 @@ namespace Unity.Startup.Procedure { try { - if (GlobalConfig.PatchData == null) + if (GlobalSetting.PatchData == null) { Log.Error("GlobalConfig PatchData Is Null!"); return; } - if (GlobalConfig.PatchData.Version != AppVersion.GameVersion) + if (GlobalSetting.PatchData.Version != AppVersion.GameVersion) { - Log.Warning($"Version inconsistency : {AppVersion.GameVersion}->{GlobalConfig.PatchData.Version} "); + Log.Warning($"Version inconsistency : {AppVersion.GameVersion}->{GlobalSetting.PatchData.Version} "); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else diff --git a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetGlobalInfoState.cs b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetGlobalInfoState.cs index 7e4e0b3..8437c3f 100644 --- a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetGlobalInfoState.cs +++ b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureGetGlobalInfoState.cs @@ -58,7 +58,7 @@ namespace Unity.Startup.Procedure return; } - GlobalConfig.PatchData = Utility.Json.ToObject(updateDataStr); + GlobalSetting.PatchData = Utility.Json.ToObject(updateDataStr); ChangeState(procedureOwner); } diff --git a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureLoadAssembly.cs b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureLoadAssembly.cs index 9f86d76..f7b9da2 100644 --- a/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureLoadAssembly.cs +++ b/Client/Assets/Scripts/Startup/Framework/Procedure/ProcedureLoadAssembly.cs @@ -13,7 +13,7 @@ namespace Unity.Startup.Procedure { public sealed class ProcedureLoadAssembly : ProcedureBase { - private bool m_enableAddressable = true; + // private bool m_enableAddressable = true; private int m_LoadAssetCount; private int m_LoadMetadataAssetCount; private int m_FailureAssetCount; @@ -35,7 +35,7 @@ namespace Unity.Startup.Procedure m_HotfixAssemblys = new List(); //AOT Assembly加载原始metadata - if (FrameworkSettingsUtils.FrameworkHotUpdateSettings.Enable) + if (AssemblyLoadData.Enable) { #if !UNITY_EDITOR m_LoadMetadataAssemblyComplete = false; @@ -49,25 +49,27 @@ namespace Unity.Startup.Procedure m_LoadMetadataAssemblyComplete = true; } - if (!FrameworkSettingsUtils.FrameworkHotUpdateSettings.Enable || GameApp.Resource.GamePlayMode == EPlayMode.EditorSimulateMode) + if (!AssemblyLoadData.Enable || + GameApp.Resource.GamePlayMode == EPlayMode.EditorSimulateMode) { m_MainLogicAssembly = GetMainLogicAssembly(); } else { - if (FrameworkSettingsUtils.FrameworkHotUpdateSettings.Enable) + if (AssemblyLoadData.Enable) { - foreach (string hotUpdateDllName in FrameworkSettingsUtils.FrameworkHotUpdateSettings.HotUpdateAssemblies) + foreach (string hotUpdateDllName in AssemblyLoadData.Instance + .HotUpdateAssemblies) { var assetLocation = hotUpdateDllName; - if (!m_enableAddressable) - { - assetLocation = Utility.Path.GetRegularPath( - Path.Combine( - "Assets", - FrameworkSettingsUtils.FrameworkHotUpdateSettings.AssemblyTextAssetPath, - $"{hotUpdateDllName}{FrameworkSettingsUtils.FrameworkHotUpdateSettings.AssemblyTextAssetExtension}")); - } + // if (!m_enableAddressable) + // { + // assetLocation = Utility.Path.GetRegularPath( + // Path.Combine( + // "Assets", + // FrameworkHotUpdateSettings.Instance.AssemblyTextAssetPath, + // $"{hotUpdateDllName}{FrameworkHotUpdateSettings.Instance.AssemblyTextAssetExtension}")); + // } Log.Info($"LoadAsset: [ {assetLocation} ]"); m_LoadAssetCount++; @@ -90,7 +92,8 @@ namespace Unity.Startup.Procedure } - protected override void OnUpdate(IFsm procedureOwner, float elapseSeconds, float realElapseSeconds) + protected override void OnUpdate(IFsm procedureOwner, float elapseSeconds, + float realElapseSeconds) { if (!m_LoadAssemblyComplete) { @@ -117,17 +120,17 @@ namespace Unity.Startup.Procedure return; } - var appType = m_MainLogicAssembly.GetType("GameLogic.HotfixEntry"); + var appType = m_MainLogicAssembly.GetType(GlobalSetting.EntranceClass); if (appType == null) { - Log.Warning($"Main logic type 'HotfixEntry' missing."); + Log.Warning($"Main logic type '{GlobalSetting.EntranceClass}' missing."); return; } - var entryMethod = appType.GetMethod("Entrance"); + var entryMethod = appType.GetMethod(GlobalSetting.EntranceMethod); if (entryMethod == null) { - Log.Warning($"Main logic entry method 'Entrance' missing."); + Log.Warning($"Main logic entry method '{GlobalSetting.EntranceMethod}' missing."); return; } @@ -141,13 +144,13 @@ namespace Unity.Startup.Procedure Assembly mainLogicAssembly = null; foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { - if (string.Compare(FrameworkSettingsUtils.FrameworkHotUpdateSettings.LogicMainDllName, $"{assembly.GetName().Name}.dll", + if (string.Compare(GlobalSetting.EntranceDll, $"{assembly.GetName().Name}.dll", StringComparison.Ordinal) == 0) { mainLogicAssembly = assembly; } - foreach (var hotUpdateDllName in FrameworkSettingsUtils.FrameworkHotUpdateSettings.HotUpdateAssemblies) + foreach (var hotUpdateDllName in AssemblyLoadData.Instance.HotUpdateAssemblies) { if (hotUpdateDllName == $"{assembly.GetName().Name}.dll") { @@ -155,7 +158,8 @@ namespace Unity.Startup.Procedure } } - if (mainLogicAssembly != null && m_HotfixAssemblys.Count == FrameworkSettingsUtils.FrameworkHotUpdateSettings.HotUpdateAssemblies.Count) + if (mainLogicAssembly != null && m_HotfixAssemblys.Count == + AssemblyLoadData.Instance.HotUpdateAssemblies.Count) { break; } @@ -183,7 +187,7 @@ namespace Unity.Startup.Procedure try { var assembly = Assembly.Load(textAsset.bytes); - if (string.Compare(FrameworkSettingsUtils.FrameworkHotUpdateSettings.LogicMainDllName, assetName, StringComparison.Ordinal) == 0) + if (string.Compare(GlobalSetting.EntranceDll, assetName, StringComparison.Ordinal) == 0) { m_MainLogicAssembly = assembly; } @@ -216,23 +220,23 @@ namespace Unity.Startup.Procedure // 注意,补充元数据是给AOT dll补充元数据,而不是给热更新dll补充元数据。 // 热更新dll不缺元数据,不需要补充,如果调用LoadMetadataForAOTAssembly会返回错误 - if (FrameworkSettingsUtils.FrameworkHotUpdateSettings.AOTMetaAssemblies.Count == 0) + if (AssemblyLoadData.Instance.AOTMetaAssemblies.Count == 0) { m_LoadMetadataAssemblyComplete = true; return; } - foreach (string aotDllName in FrameworkSettingsUtils.FrameworkHotUpdateSettings.AOTMetaAssemblies) + foreach (string aotDllName in AssemblyLoadData.Instance.AOTMetaAssemblies) { var assetLocation = aotDllName; - if (!m_enableAddressable) - { - assetLocation = Utility.Path.GetRegularPath( - Path.Combine( - "Assets", - FrameworkSettingsUtils.FrameworkHotUpdateSettings.AssemblyTextAssetPath, - $"{aotDllName}{FrameworkSettingsUtils.FrameworkHotUpdateSettings.AssemblyTextAssetExtension}")); - } + // if (!m_enableAddressable) + // { + // assetLocation = Utility.Path.GetRegularPath( + // Path.Combine( + // "Assets", + // FrameworkHotUpdateSettings.Instance.AssemblyTextAssetPath, + // $"{aotDllName}{FrameworkHotUpdateSettings.Instance.AssemblyTextAssetExtension}")); + // } Log.Info($"LoadMetadataAsset: [ {assetLocation} ]"); @@ -266,7 +270,8 @@ namespace Unity.Startup.Procedure #if ENABLE_HYBRIDCLR // 加载assembly对应的dll,会自动为它hook。一旦Aot泛型函数的native函数不存在,用解释器版本代码 HomologousImageMode mode = HomologousImageMode.SuperSet; - LoadImageErrorCode err = (LoadImageErrorCode)HybridCLR.RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, mode); + LoadImageErrorCode err = + (LoadImageErrorCode)HybridCLR.RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, mode); Log.Warning($"LoadMetadataForAOTAssembly:{assetName}. mode:{mode} ret:{err}"); #endif } diff --git a/Client/Assets/Test/GameBase.dll.bytes b/Client/Assets/Test/GameBase.dll.bytes index b4a91d4e51712531f989aab064f6c15ed9576859..dd81d213f467fbe4bc9c523e6ad9ca81fcefe4c1 100644 GIT binary patch delta 216 zcmZorX;7Ka!Llyb_vFML8OC`NSB5isO=e`QXZ$d^5lGf;W@J)jW?!Mnz`)4xV6!gk zVP=85#=E^ym%?=%11Ce9p2-ozs_UokNH1~4%&Fr-hezZ9AE59GSc7+kB#@#9=G%vHHGN33wD>b=f@+~fRU8uU&H&AsTGi`IO zPRLij9=v^x?ujCxi7?PJ*^gVAv2Jn}xAx>|+y$HYcz!W6EwJ1yDDa+fq5(Sq$XQM1 delta 214 zcmZorX;7Ka!E*55ybTk3WEiJSTp7;jIGK^Lp7F)xMj%-gQRctZ0s tODY43^0QKtOD11nv||^PR8ZG9v!5)=G#SV)Z|G|{uz5YxTW@BdfdKP4Dlh;5 delta 133 zcmZ26mvPQq#t8)qS9};4l$~<&lNcBnN;;T+Of5g*-BOXUVp^S-=}nLO>n2Vp5O-o= zWbkERVz|S=%J01*+XS2$SQ(^P!WdW>{xD4TVXR|wvtkZU iO`3d@(T<%%KwM5u*KD#J(_|n!uc5VJ`{o@?Z@mF*#wCXU diff --git a/Client/Assets/Test/GameLib.dll.bytes b/Client/Assets/Test/GameLib.dll.bytes index d34edd440ec1d43a1b657e42f0986a997adaec2c..64295b6e526d4bb9583021cc10ec502019cb14da 100644 GIT binary patch delta 231 zcmZorX;7Ka!6M&(WADTs8OB)?SB5jXPG)4RXM8ca5lB{UW@J)jW?!Jmz`)3`VY4pl zer5rNHNu}owV(SeJ}7)kU=&$n>>?C zS$S?0PrFd6oX0Z0yn?5d%O)`b)wo;5gyv4b?rGK_r_SB5j%OlD-PXM8ZZ5l9wnW@J)jW}l(Sz`)3`VzVym zerADtjzYIC*Qq(T_LZBmxc=L;`42}9BX8I9nl=VT-vA~C28P(lrCjo?qCicelV@@% zOWCLXIq6@e=e<&8-^0m@Uu7AAYTT@1!c&tb-{*2Of=bVR36%yJC3R$NZt~gk&+GS# zPEP?E1Os&-w!%b3F~)+)dEA;@|5X_j7z9AFlNWI3O*G)x%*XSKnQ4OMWyhw;K3#t8)q9X<>U%1$}?Nem1ObEA0Lg;M1_mht5kJgrH(8ufQAC+Voq?TUuYfZHD}y3S7y}CfGvj0*#yWm?E1uB2 u%#zB0qWrAXu5lBwo%*ZsAm;HbP0|OU>#OAsD z?z{r6$!oSQ&ED$W$M{uoo?8z0<}Wf6Sa@&E{qTc<(KmpJfq@}o@RvVxuo5@=h zm6casy?Jb_ij)7$b|qHX-IIG1-0HYPBdT# E0ONd74*&oF delta 212 zcmZpOXo#55!IJx-Zqvjb8OC)JSB5i2O=e`QXWTKl5lHrJW@MVm%f7>bfq{!bVDnsl zcV2;s#x+HY6Z?E-t6g8+eBf&T<}Wf6Sa>I#|J%#J=o`Sqz`zhcd7`2`t1(cM@#L+F z%2Hn+wUyd#7IfbowqxyKCDDFHpc*%;nDEr3$-fmnbfMDXzoF7Vqj+@!IXNX?*!-8_ wdaB$6GzbRfOfFE8X6&2XqolQYt5PKML<5e^d}_a#nKl?~7SwvrIMIL|0B5#KLjV8( diff --git a/Client/Assets/Test/GameLogic.pdb.bytes b/Client/Assets/Test/GameLogic.pdb.bytes index 9c3ad1b031e88df730401f637df67644bf1649c8..59ce1a6bf6b911f4f641f4123cad73814ac29380 100644 GIT binary patch delta 621 zcmYL_Pizcf7{;G>X1>{#u9WzbQcWAg_!F8+iQurApbnZcGi!^RMG#b|Ly^?VvI&>9 zUj#`jgh=Zm&7h55nuvb~;o^V;PQqz}lpuKDuf-(K?|Gm1eZMa=Q;F$kOr?VjJsDt* zzprCEfc_URAKsbkw_PgER&~SWN3VJ--_DhKy4yh53JXQ{GW&h@XY3$CiY%nrH?SAj zOYHTQjYXEl8xsS*7B+NX<2mac>l4ckrSD*B=wJuy2o5!TsD%d? zH(ifsYo?6yo24zA6#CpNb`tHGx6HHpseQh>Wo0UJU{7b)#zP%@cjh|vZpTkdp3&en zE>G(Lr)j)Craw5#l4Jc7v7V>?g^JFp72}iqVtq}m{u}n|_eyif59A-`zsD!t!Pc5D zdh`^(3V!>an{M>htiM-iK9h`!Rq>{%U`?A(BM2G=>jYUrPJi6Iw94e`l83aHJvvi1 z!-bN~WJoGA&g$Xp@kw_j%kl7mndp}GC;tCC<#d!1OqU(GCt4s_B?tuD1cwFPg0kSE L4z^sj`5*rQ70;X^ delta 608 zcmYL^O-NKx6vzMP-S^&1NMMO2l^6hAi6m$`Tg!-9mOauG$Vc10U$6J}T-7M*jodhq}K&;Oot5BDvFG#65?vn-ba zwj?qqIshzuzI?hiT$6m#@_77tdEr3r?XUiuxuJ9QARL5+UiLorDfXA_KiL&oh!bHS zdl&l^_H~v*xn=Q$?eSVDT=f)Qu|BZAuolg^jXd8*J1fKLVcqa$K7tYB4(|94W_K~Z zngbUL#tBP4VLl+NO%Y1?7nVOlg{cXL!;dsZO`RTLl2yaw;MczQUG|8n9|Wt|i?Io% z*oaEF7;`JRx3}O2Y{V@^4o2Kj6~+G4C*}qHM%{Aj_o(#I4t>&2M56iYOJdvNddl9p zQlHZE_U`EN`T6^LyYny1>Wovp(#dYs51pF7;fS7dG>7cn?6d5*@R~c>R5VnVyofpr z$#<`3eox;{?iH%m61 z38_rGS-(hk=Z{O4>;6;I(Fa;*690F~?LY}u%Z%&^$^=z{27xCyCO9ML6Ab9~L&JXn D5g?Y- diff --git a/Client/Assets/Test/GameProto.dll.bytes b/Client/Assets/Test/GameProto.dll.bytes index 12acb027db4d25bd0bb958b2e45ee82528ba39c6..8901b9ec6d95b58cdc754264fdaebd8c07bad3c6 100644 GIT binary patch delta 224 zcmZqJ!`QHgaY6?R--?ejC-%rNE}OVAoH2MZBV#?Iz~n|C*}j>P$<>g3LmmUeEQW^7 zzQ+Ed0twG11eV>X_grUMwlzkg)B1KWLgb05eBA$*a{OB#TeTs7YAr))@^2Fay4XMk;lL=i=kq( zud%v@vN~{wlX{Wd2H`jsM5fAeYgfueKszg^b!LrHj#{hVj``&}LTBdbM| zM$zRc*-QRK>Y6V3nkL0$9l4eKl>D0fjl4(B)-`!i*JTSCBTta0$@^roMVGl2O%{^x zk~_(hP0~o#BrjQ)C1fqRhdfLc+AT8QuJd@gK}||f9(+O~uLRi~u}WpoDj(t$ z25}Z6xPvAp6{eTn z@Uk0Tc^ERpQf-KV0@$hyaYPupO@r+)xNC#EHn?kpC(M>Wb+(ivh#IWHI&8u_h+=zn zj&$HKzQF)aBVgw6T5@EF`aGgA>3^;E$?wpX`^1OH5Y2h`X=Y#+im<@+@jiWAPlF1)@e7><~)cTYoGMA59_`qBEPDN}J^@>n3 zX-CpT|6MqRbYKd;l*Mvfx+IsQ*3?`{mV-I1T&brHFg|h~(rq&49ALcRyvq28(_*p7 zEvKLHrt<~HJI+;%_noa4+jP0-JVf)*Il%ajbJ${)W%jGol3J2wmsK^*jD6}vdS7b! zTt{U?-KK4?Hmb64r?xiFT<% z_p|X|j*hBE_ndg&nx~Gti{fjv*0(mO2kx1ZX1Y}%EAg5eYHL<;e2unz)t{B{ylq?B zn$+W-g!^EoU%l*^6JND$OS?tw@+7R*~^^;~y!%@l3+;5fw`8W9dpw>KCd(BjHWPT2y+rvZoudA7j6Kkk<2gcE)1w z9d)l=N_6?R^!BX7AA4Uq**1HJeQ7L34cGmo<*U!?%aY#I`X#ur=kNNT^_0@_dVC_Z Ru;;?M*DMnUsS7vi+J6wzux$VU delta 1777 zcmY+_e@sF1h-T`nIcK7Cye80~*=eg%R z=P-_6)V{r_wXJ&a`x=o6rS&Tpi%91WgLyMsCOmy0J3HgfrH?H0UwP`lmbUGYD$%4) zblFAjC;uexkU5$r`I;_^$d%+L5 z#>j(Y7kP^`n{_ENYckiYMGB;qBD2}2F zz39VfoW}sJ;btI324M@PNG|-yM^Eo-PZW7}}=kv$=g96=vW<2(j%4P`+O zyWwFsJaRMSl|k65ypoH1L9du1m0q^P%XWCVYcF^0<*vOvp-=o(J}JgLEJQVyUs zIy6?LNh@}s9Y@d!e=v>Lk|sUWC$J9X^rx!Q8IiFd2oxblzt= z7o~Ie=`y`KLyE8fby$VBumLfY1v6wbSwV(_PT5xNlx}2&ostVb@==IVl%YKAoFx?$ zVbr1?tMN9Pun8ZBUGiyoXzN|lNqu3sc8jUTEu;7YADXXgziNIcH8PctTKK@%@|}uU zhU-8mnY1Elxc@qwLZ)Ig4#_;}kbN?dqj!yok}O-(qFi~$=w`fS?A9$ZV01I~8~u!b z7$%cNt{4*-FB>x%uNp5i-Y}vjORiiucGKK6x*7j5PMOT|ytSYDwo&4;N@YzWV~09C z_E^%a$4wQri&bn~-~p@6otf(|D4wG(jVny~ziWJ_QK>w8(dc;J*LX&)u}_Jg(d1JH zNAxeMYxe2!E1KGx-dB?ykBpf4NiBDj#%G$1W}iCjm^NajTHSRdtkb-+d5wcTE{FvsXRoO1!3DHMxr7YqaF3URT2NwluV?R(5y7 zeK7NlTIeo_ugc7z`p})QYOGkDa~Hw$|@jf8Lbb{*`asJkR!$*-HI(X4}rp^7ytkO diff --git a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs b/Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs similarity index 75% rename from Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs rename to Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs index d415312..0ad5755 100644 --- a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs +++ b/Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs @@ -1,17 +1,30 @@ -using System.Collections.Generic; -using System.IO; -using AlicizaX.Editor; +using System.Collections.Generic; using Newtonsoft.Json; using Sirenix.OdinInspector; +using Sirenix.OdinInspector.Editor; using UnityEditor; using UnityEngine; namespace AlicizaX.UI.Editor { - [System.Serializable] - [DisplayName("UI构建设置")] - internal sealed class UIGenerateConfigurationTab : GameFrameworkTabBase + public class UISettingEditorWindow : OdinEditorWindow { + [MenuItem("Tools/AlicizaX/UI Setting Window")] + private static void OpenWindow() + { + GetWindow().Show(); + } + + + protected override void Initialize() + { + uiGenerateConfiguration = UIGenerateConfiguration.Instance; + UIGenerateCommonData = uiGenerateConfiguration.UIGenerateCommonData; + UIScriptGenerateConfigs = uiGenerateConfiguration.UIScriptGenerateConfigs; + UIElementRegexConfigs = uiGenerateConfiguration.UIElementRegexConfigs; + RefreshLabel(); + } + // [Required] [InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)] [DisableInPlayMode] [HideLabel] private UIGenerateConfiguration uiGenerateConfiguration; @@ -21,8 +34,7 @@ namespace AlicizaX.UI.Editor [TabGroup("UI基础设置")] [LabelText("脚本生成预览")] [ShowInInspector] [ReadOnly] [OnValueChanged("RefreshLabel")] private string previewLabel; - [TabGroup("UI基础设置")] [LabelText("组件生成预览")] [ShowInInspector] [ReadOnly] [OnValueChanged("RefreshLabel")] - [SuffixLabel("(下标0开始)")] + [TabGroup("UI基础设置")] [LabelText("组件生成预览")] [ShowInInspector] [ReadOnly] [OnValueChanged("RefreshLabel")] [SuffixLabel("(下标0开始)")] private string previewCompLabel; [Required] [DisableInPlayMode] [HideLabel] [TabGroup("UI构建配置")] [SerializeField] [TableList(ShowIndexLabels = false, DrawScrollView = true, AlwaysExpanded = true)] @@ -48,18 +60,21 @@ namespace AlicizaX.UI.Editor UIElementRegexConfigs = JsonConvert.DeserializeObject>(text); } - public UIGenerateConfigurationTab() + + protected override void OnDisable() { - uiGenerateConfiguration = UIGenerateConfiguration.Instance; - UIGenerateCommonData = uiGenerateConfiguration.UIGenerateCommonData; - UIScriptGenerateConfigs = uiGenerateConfiguration.UIScriptGenerateConfigs; - UIElementRegexConfigs = uiGenerateConfiguration.UIElementRegexConfigs; - RefreshLabel(); + base.OnDisable(); + uiGenerateConfiguration.UIGenerateCommonData = UIGenerateCommonData; + uiGenerateConfiguration.UIScriptGenerateConfigs = UIScriptGenerateConfigs; + uiGenerateConfiguration.UIElementRegexConfigs = UIElementRegexConfigs; + EditorUtility.SetDirty(uiGenerateConfiguration); + AssetDatabase.SaveAssets(); + UIGenerateConfiguration.Save(); } - protected override void Save() + protected override void OnDestroy() { - base.Save(); + base.OnDestroy(); uiGenerateConfiguration.UIGenerateCommonData = UIGenerateCommonData; uiGenerateConfiguration.UIScriptGenerateConfigs = UIScriptGenerateConfigs; uiGenerateConfiguration.UIElementRegexConfigs = UIElementRegexConfigs; diff --git a/Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs.meta b/Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs.meta new file mode 100644 index 0000000..2174bd1 --- /dev/null +++ b/Client/Packages/com.alicizax.unity.ui/Editor/GenerateTool/UISettingEditorWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d6e004459b3645d4b3022bdde89795b9 +timeCreated: 1741340568 \ No newline at end of file diff --git a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfiguration.cs b/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfiguration.cs index c0e2bda..7f28ae8 100644 --- a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfiguration.cs +++ b/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfiguration.cs @@ -29,7 +29,7 @@ namespace AlicizaX.UI.Editor } [System.Serializable] - internal class UIEelementRegexData + public class UIEelementRegexData { public string uiElementRegex; @@ -66,7 +66,7 @@ namespace AlicizaX.UI.Editor } [System.Serializable] - internal class UIScriptGenerateData + public class UIScriptGenerateData { public string ConfigName; diff --git a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs.meta b/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs.meta deleted file mode 100644 index 85e1c08..0000000 --- a/Client/Packages/com.alicizax.unity.ui/Editor/UIConfig/UIGenerateConfigurationTab.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c093bf237b3e4243a52e04a5db36f86d -timeCreated: 1737705566 \ No newline at end of file diff --git a/Client/Packages/com.alicizax.unity.ui/package.json b/Client/Packages/com.alicizax.unity.ui/package.json index a5d3e4a..72acea2 100644 --- a/Client/Packages/com.alicizax.unity.ui/package.json +++ b/Client/Packages/com.alicizax.unity.ui/package.json @@ -6,7 +6,7 @@ "version": "1.0.1", "unity": "2025.1", "keywords": [ - "Game Framework X" + "Aliciza X" ], "repository": { "name": "com.alicizax.unity", diff --git a/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs b/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs deleted file mode 100644 index 2270b1f..0000000 --- a/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.IO; -using AlicizaX.Runtime; -using UnityEditor; -using UnityEngine; - -namespace AlicizaX.Editor -{ - static class FrameworkAssetInitlized - { - [InitializeOnLoadMethod] - static void Initlize() - { - string FloderPath = "Assets/Resources/"; - if (!Directory.Exists(FloderPath)) - { - Directory.CreateDirectory(FloderPath); - } - - string publisherPath = Path.Combine(FloderPath, "FrameworkPublishSettings.asset"); - string hotPath = Path.Combine(FloderPath, "FrameworkHotUpdateSettings.asset"); - if (!File.Exists(publisherPath)) - { - var publisherObject = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(publisherObject, publisherPath); - } - - if (!File.Exists(hotPath)) - { - var hotObject = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(hotObject, hotPath); - } - - AssetDatabase.Refresh(); - } - } -} diff --git a/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs.meta b/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs.meta deleted file mode 100644 index 7b502d4..0000000 --- a/Client/Packages/com.alicizax.unity/Editor/Constant/FrameworkAssetInitlized.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9e6620d843d745fba3213017d052d5e1 -timeCreated: 1739170824 \ No newline at end of file diff --git a/Client/Packages/com.alicizax.unity/Editor/EditorWindow/GameFrameworkPreferenceWindow.cs b/Client/Packages/com.alicizax.unity/Editor/EditorWindow/GameFrameworkPreferenceWindow.cs index 4a0d651..1ccb997 100644 --- a/Client/Packages/com.alicizax.unity/Editor/EditorWindow/GameFrameworkPreferenceWindow.cs +++ b/Client/Packages/com.alicizax.unity/Editor/EditorWindow/GameFrameworkPreferenceWindow.cs @@ -1,97 +1,97 @@ -using UnityEditor; -using UnityEngine; -using System; -using System.Linq; -using System.Reflection; -using System.Collections.Generic; -using AlicizaX.Runtime; -using Sirenix.OdinInspector.Editor; - -namespace AlicizaX.Editor -{ - public class GameFrameworkPreferenceWindow : OdinMenuEditorWindow - { - private List m_TabTypes; - private readonly Dictionary _tabBases = new(); - - [MenuItem("Tools/AlicizaX/Preference Window")] - public static void ShowWindow() - { - GetWindow(true, "Preference Window"); - } - - protected override void OnEnable() - { - base.OnEnable(); - this.position = new Rect(this.position.x, this.position.y, 800, 600); - - var assemblies = Utility.Assembly.GetAssemblies(); - - m_TabTypes = new List(); - - foreach (var assembly in assemblies) - { - var types = assembly.GetTypes(); - foreach (var type in types) - { - if (typeof(GameFrameworkTabBase).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract) - { - var displayNameAttr = (DisplayNameAttribute)Attribute.GetCustomAttribute(type, typeof(DisplayNameAttribute)); - if (displayNameAttr != null) - { - m_TabTypes.Add(type); - } - } - } - } - - m_TabTypes = m_TabTypes.OrderBy(t => ((DisplayNameAttribute)Attribute.GetCustomAttribute(t, typeof(DisplayNameAttribute))).DisplayName).ToList(); - } - - - protected override void OnDestroy() - { - base.OnDestroy(); - if (this.MenuTree != null && this.MenuTree.Selection.SelectedValue != null) - { - var selectTarget = this.MenuTree.Selection.SelectedValue; - if (selectTarget != null) - { - var selectType = selectTarget.GetType(); - if (_tabBases.TryGetValue(selectType, out GameFrameworkTabBase tab)) - { - tab.Save(); - } - } - } - } - - protected override OdinMenuTree BuildMenuTree() - { - var tree = new OdinMenuTree(); - foreach (var tabType in m_TabTypes) - { - DisplayNameAttribute displayNameAttribute = (DisplayNameAttribute)Attribute.GetCustomAttribute(tabType, typeof(DisplayNameAttribute)); - GameFrameworkTabBase instance = (GameFrameworkTabBase)Activator.CreateInstance(tabType); - _tabBases.Add(tabType, instance); - tree.Add(displayNameAttribute.DisplayName, instance); - } - - tree.Selection.SelectionChanged += SelectionOnSelectionChanged; - return tree; - } - - private void SelectionOnSelectionChanged(SelectionChangedType obj) - { - var selectTarget = this.MenuTree.Selection.SelectedValue; - if (selectTarget != null) - { - var selectType = selectTarget.GetType(); - if (_tabBases.TryGetValue(selectType, out GameFrameworkTabBase tab)) - { - tab.Save(); - } - } - } - } -} +// using UnityEditor; +// using UnityEngine; +// using System; +// using System.Linq; +// using System.Reflection; +// using System.Collections.Generic; +// using AlicizaX.Runtime; +// using Sirenix.OdinInspector.Editor; +// +// namespace AlicizaX.Editor +// { +// public class GameFrameworkPreferenceWindow : OdinMenuEditorWindow +// { +// private List m_TabTypes; +// private readonly Dictionary _tabBases = new(); +// +// [MenuItem("Tools/AlicizaX/Preference Window")] +// public static void ShowWindow() +// { +// GetWindow(true, "Preference Window"); +// } +// +// protected override void OnEnable() +// { +// base.OnEnable(); +// this.position = new Rect(this.position.x, this.position.y, 800, 600); +// +// var assemblies = Utility.Assembly.GetAssemblies(); +// +// m_TabTypes = new List(); +// +// foreach (var assembly in assemblies) +// { +// var types = assembly.GetTypes(); +// foreach (var type in types) +// { +// if (typeof(GameFrameworkTabBase).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract) +// { +// var displayNameAttr = (DisplayNameAttribute)Attribute.GetCustomAttribute(type, typeof(DisplayNameAttribute)); +// if (displayNameAttr != null) +// { +// m_TabTypes.Add(type); +// } +// } +// } +// } +// +// m_TabTypes = m_TabTypes.OrderBy(t => ((DisplayNameAttribute)Attribute.GetCustomAttribute(t, typeof(DisplayNameAttribute))).DisplayName).ToList(); +// } +// +// +// protected override void OnDestroy() +// { +// base.OnDestroy(); +// if (this.MenuTree != null && this.MenuTree.Selection.SelectedValue != null) +// { +// var selectTarget = this.MenuTree.Selection.SelectedValue; +// if (selectTarget != null) +// { +// var selectType = selectTarget.GetType(); +// if (_tabBases.TryGetValue(selectType, out GameFrameworkTabBase tab)) +// { +// tab.Save(); +// } +// } +// } +// } +// +// protected override OdinMenuTree BuildMenuTree() +// { +// var tree = new OdinMenuTree(); +// foreach (var tabType in m_TabTypes) +// { +// DisplayNameAttribute displayNameAttribute = (DisplayNameAttribute)Attribute.GetCustomAttribute(tabType, typeof(DisplayNameAttribute)); +// GameFrameworkTabBase instance = (GameFrameworkTabBase)Activator.CreateInstance(tabType); +// _tabBases.Add(tabType, instance); +// tree.Add(displayNameAttribute.DisplayName, instance); +// } +// +// tree.Selection.SelectionChanged += SelectionOnSelectionChanged; +// return tree; +// } +// +// private void SelectionOnSelectionChanged(SelectionChangedType obj) +// { +// var selectTarget = this.MenuTree.Selection.SelectedValue; +// if (selectTarget != null) +// { +// var selectType = selectTarget.GetType(); +// if (_tabBases.TryGetValue(selectType, out GameFrameworkTabBase tab)) +// { +// tab.Save(); +// } +// } +// } +// } +// } diff --git a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/BuildDLLCommand.cs b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/BuildDLLCommand.cs index 9bde1b0..dd3a71a 100644 --- a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/BuildDLLCommand.cs +++ b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/BuildDLLCommand.cs @@ -10,6 +10,7 @@ using UnityEngine; public static class BuildDLLCommand { private const string EnableHybridClrScriptingDefineSymbol = "ENABLE_HYBRIDCLR"; + public const string AssemblyTextAssetPath = "Bundles/DLL"; static BuildDLLCommand() { @@ -18,7 +19,7 @@ public static class BuildDLLCommand /// /// 禁用HybridCLR宏定义。 /// - [MenuItem("Tools/AlicizaX/HybridCLR/Define Symbols/Disable HybridCLR", false, 30)] + [MenuItem("HybridCLR/Tools/Define Symbols/Disable HybridCLR", false, 30)] public static void Disable() { ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableHybridClrScriptingDefineSymbol); @@ -29,7 +30,7 @@ public static class BuildDLLCommand /// /// 开启HybridCLR宏定义。 /// - [MenuItem("Tools/AlicizaX/HybridCLR/Define Symbols/Enable HybridCLR", false, 31)] + [MenuItem("HybridCLR/Tools/Tools/Define Symbols/Enable HybridCLR", false, 31)] public static void Enable() { ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableHybridClrScriptingDefineSymbol); @@ -39,10 +40,9 @@ public static class BuildDLLCommand } #if ENABLE_HYBRIDCLR - [MenuItem("Tools/AlicizaX/HybridCLR/Build/BuildAssets And CopyTo AssemblyTextAssetPath")] + [MenuItem("HybridCLR/Tools/Build/BuildAssets And CopyTo AssemblyTextAssetPath")] public static void BuildAndCopyDlls() { - BuildTarget target = EditorUserBuildSettings.activeBuildTarget; CompileDllCommand.CompileDll(target); CopyAOTHotUpdateDlls(target); @@ -69,14 +69,15 @@ public static class BuildDLLCommand #if ENABLE_HYBRIDCLR var target = EditorUserBuildSettings.activeBuildTarget; string aotAssembliesSrcDir = SettingsUtil.GetAssembliesPostIl2CppStripDir(target); - string aotAssembliesDstDir = Application.dataPath + "/" + ScriptableSingletonUtil.Get().AssemblyTextAssetPath; + string aotAssembliesDstDir = Application.dataPath + "/" + AssemblyTextAssetPath; - foreach (var dll in ScriptableSingletonUtil.Get().AOTMetaAssemblies) + foreach (var dll in AssemblyLoadData.Instance.AOTMetaAssemblies) { string srcDllPath = $"{aotAssembliesSrcDir}/{dll}"; if (!System.IO.File.Exists(srcDllPath)) { - Debug.LogError($"ab中添加AOT补充元数据dll:{srcDllPath} 时发生错误,文件不存在。裁剪后的AOT dll在BuildPlayer时才能生成,因此需要你先构建一次游戏App后再打包。"); + Debug.LogError( + $"ab中添加AOT补充元数据dll:{srcDllPath} 时发生错误,文件不存在。裁剪后的AOT dll在BuildPlayer时才能生成,因此需要你先构建一次游戏App后再打包。"); continue; } @@ -93,7 +94,7 @@ public static class BuildDLLCommand var target = EditorUserBuildSettings.activeBuildTarget; string hotfixDllSrcDir = SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target); - string hotfixAssembliesDstDir = Application.dataPath + "/" + ScriptableSingletonUtil.Get().AssemblyTextAssetPath; + string hotfixAssembliesDstDir = Application.dataPath + "/" + AssemblyTextAssetPath; foreach (var dll in SettingsUtil.HotUpdateAssemblyFilesExcludePreserved) { string dllPath = $"{hotfixDllSrcDir}/{dll}"; diff --git a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs deleted file mode 100644 index 69bff7e..0000000 --- a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using AlicizaX.Editor; -using Sirenix.OdinInspector; -using Sirenix.OdinInspector.Editor; -using Sirenix.Serialization; -using UnityEditor; -using UnityEngine; - -namespace AlicizaX.Runtime -{ - [DisplayName("热更设置")] - [Serializable] - internal sealed class HybridCLRSettingTab : GameFrameworkTabBase - { - [Required][InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)][DisableInPlayMode] [HideLabel] - public FrameworkHotUpdateSettings FrameworkHotUpdateSettings; - - public HybridCLRSettingTab() - { - FrameworkHotUpdateSettings = ScriptableSingletonUtil.Get(); - } - - [Sirenix.OdinInspector.Button(ButtonSizes.Large)] - private void RefreshAssembly() - { - SyncAssemblyContent.RefreshAssembly(); - } - - protected internal override void Save() - { - base.Save(); - EditorUtility.SetDirty(FrameworkHotUpdateSettings); - AssetDatabase.SaveAssets(); - } - } -} diff --git a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs.meta b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs.meta deleted file mode 100644 index c525112..0000000 --- a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/HybridCLRSettingTab.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ab21809ce8ad4d5ebe950b70107deb00 -timeCreated: 1737525094 \ No newline at end of file diff --git a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/SynAssemblysContent.cs b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/SynAssemblysContent.cs index 5cd3fdb..be72960 100644 --- a/Client/Packages/com.alicizax.unity/Editor/HybridCLR/SynAssemblysContent.cs +++ b/Client/Packages/com.alicizax.unity/Editor/HybridCLR/SynAssemblysContent.cs @@ -1,15 +1,20 @@ +using System.IO; +using AlicizaX.Runtime; using UnityEditor; namespace AlicizaX.Editor { public static class SyncAssemblyContent { + [MenuItem("HybridCLR/Sync Assembly")] public static void RefreshAssembly() { - ScriptableSingletonUtil.Get().HotUpdateAssemblies = HybridCLR.Editor.SettingsUtil.HotUpdateAssemblyFilesIncludePreserved; - ScriptableSingletonUtil.Get().AOTMetaAssemblies = HybridCLR.Editor.SettingsUtil.AOTAssemblyNames; + AssemblyLoadData assemblyLoadData = new AssemblyLoadData(); + assemblyLoadData.HotUpdateAssemblies = HybridCLR.Editor.SettingsUtil.HotUpdateAssemblyFilesIncludePreserved; + assemblyLoadData.AOTMetaAssemblies = HybridCLR.Editor.SettingsUtil.AOTAssemblyNames; + File.WriteAllText("Assets/Resources/AssemblyLoadData.json", Utility.Json.ToJson(assemblyLoadData)); AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); } } -} \ No newline at end of file +} diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs b/Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs new file mode 100644 index 0000000..b41a771 --- /dev/null +++ b/Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs @@ -0,0 +1,29 @@ +using System; +using UnityEngine; + +namespace AlicizaX.Runtime +{ + [Serializable] + public class AppBuilderSetting + { + public static AppBuilderSetting Instance + { + get + { + if (_instance == null) + { + TextAsset text = Resources.Load("AppBuilderSetting"); + _instance = Utility.Json.ToObject(text.text); + } + + return _instance; + } + } + + private static AppBuilderSetting _instance; + + public bool DebugMode = false; + public int ResMode = 0; + public Language Language = Runtime.Language.ChineseSimplified; + } +} diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs.meta b/Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs.meta similarity index 100% rename from Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs.meta rename to Client/Packages/com.alicizax.unity/Runtime/Constant/AppBuilderSetting.cs.meta diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs b/Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs new file mode 100644 index 0000000..589afa8 --- /dev/null +++ b/Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using AlicizaX.Runtime; +using UnityEngine; +using UnityEngine.Serialization; + +/// +/// HybridCLRCustomGlobalSettings. +/// +[Serializable] +public class AssemblyLoadData +{ + public static bool Enable + { + get + { +#if ENABLE_HYBRIDCLR + return true; +#else + return false; +#endif + } + } + + public static AssemblyLoadData Instance + { + get + { + if (_instance == null) + { + TextAsset text = Resources.Load("AssemblyLoadData"); + _instance = Utility.Json.ToObject(text.text); + } + + return _instance; + } + } + + private static AssemblyLoadData _instance; + + + public List HotUpdateAssemblies = new List() + { "GameLib.dll", "GameProto.dll", "GameBase.dll", "GameLogic.dll" }; + + public List AOTMetaAssemblies = new List() { "mscorlib.dll", "System.dll", "System.Core.dll" }; +} diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs.meta b/Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs.meta similarity index 100% rename from Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs.meta rename to Client/Packages/com.alicizax.unity/Runtime/Constant/AssemblyLoadData.cs.meta diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs b/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs deleted file mode 100644 index 228e81b..0000000 --- a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkHotUpdateSettings.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using AlicizaX.Runtime; -using UnityEngine; -using UnityEngine.Serialization; - -/// -/// HybridCLRCustomGlobalSettings. -/// -[Serializable] -public class FrameworkHotUpdateSettings : ScriptableObject -{ - public bool Enable - { - get - { -#if ENABLE_HYBRIDCLR - return true; -#else - return false; -#endif - } - } - - [Header("Auto sync with [HybridCLRGlobalSettings]")] [Tooltip("You should modify the file form file path [Assets/CustomHybridCLR/Settings/HybridCLRGlobalSettings.asset]")] - public List HotUpdateAssemblies = new List() { "GameLib.dll", "GameProto.dll", "GameBase.dll", "GameLogic.dll" }; - - [Header("Need manual setting!")] public List AOTMetaAssemblies = new List() { "mscorlib.dll", "System.dll", "System.Core.dll" }; - - /// - /// Dll of main business logic assembly - /// - public string LogicMainDllName = "GameLogic.dll"; - - /// - /// 程序集文本资产打包Asset后缀名 - /// - public string AssemblyTextAssetExtension = ".bytes"; - - /// - /// 程序集文本资产资源目录 - /// - public string AssemblyTextAssetPath = "Bundles/DLL"; -} diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs b/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs deleted file mode 100644 index 3f0adeb..0000000 --- a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkPublishSettings.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Sirenix.OdinInspector; -using UnityEngine; - -namespace AlicizaX.Runtime -{ - [Serializable] - public class FrameworkPublishSettings : ScriptableObject - { - public int ResMode = 0; - public Language Language = Runtime.Language.ChineseSimplified; - } -} diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs b/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs deleted file mode 100644 index b9ea8bf..0000000 --- a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs +++ /dev/null @@ -1,38 +0,0 @@ -using UnityEngine; - -namespace AlicizaX.Runtime -{ - public static class FrameworkSettingsUtils - { - public static FrameworkHotUpdateSettings FrameworkHotUpdateSettings - { - get - { - if (_frameworkHotUpdateSettings == null) - { - _frameworkHotUpdateSettings = Resources.Load("FrameworkHotUpdateSettings"); - } - - return _frameworkHotUpdateSettings; - } - } - - private static FrameworkHotUpdateSettings _frameworkHotUpdateSettings; - - - public static FrameworkPublishSettings FrameworkPublishSettings - { - get - { - if (_frameworkPublishSettings == null) - { - _frameworkPublishSettings = Resources.Load("FrameworkPublishSettings"); - } - - return _frameworkPublishSettings; - } - } - - private static FrameworkPublishSettings _frameworkPublishSettings; - } -} \ No newline at end of file diff --git a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs.meta b/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs.meta deleted file mode 100644 index ef89f63..0000000 --- a/Client/Packages/com.alicizax.unity/Runtime/Constant/FrameworkSettingsUtils.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2cd40b376b4a493faea997eb0ecf31c7 -timeCreated: 1737532661 \ No newline at end of file diff --git a/Client/Packages/manifest.json b/Client/Packages/manifest.json index 96152fd..4a77a70 100644 --- a/Client/Packages/manifest.json +++ b/Client/Packages/manifest.json @@ -1,6 +1,6 @@ { "dependencies": { - "com.code-philosophy.hybridclr": "https://github.com/focus-creative-games/hybridclr_unity.git", + "com.code-philosophy.hybridclr": "https://gitee.com/focus-creative-games/hybridclr_unity.git", "com.fantasy.unity": "http://101.34.252.46:3000/AlicizaX/Fantasy.Unity.git", "com.paps.unity-toolbar-extender-ui-toolkit": "http://101.34.252.46:3000/AlicizaX/com.paps.unity-toolbar-extender-ui-toolkit.git", "com.unity.ai.navigation": "2.0.4", diff --git a/Client/Packages/packages-lock.json b/Client/Packages/packages-lock.json index 9bcaffc..6853da9 100644 --- a/Client/Packages/packages-lock.json +++ b/Client/Packages/packages-lock.json @@ -152,7 +152,7 @@ "dependencies": {} }, "com.code-philosophy.hybridclr": { - "version": "https://github.com/focus-creative-games/hybridclr_unity.git", + "version": "https://gitee.com/focus-creative-games/hybridclr_unity.git", "depth": 0, "source": "git", "dependencies": {}, diff --git a/Client/ProjectSettings/EditorBuildSettings.asset b/Client/ProjectSettings/EditorBuildSettings.asset index 4f3fb85..4e61185 100644 --- a/Client/ProjectSettings/EditorBuildSettings.asset +++ b/Client/ProjectSettings/EditorBuildSettings.asset @@ -6,7 +6,7 @@ EditorBuildSettings: serializedVersion: 2 m_Scenes: - enabled: 1 - path: Assets/Main.unity + path: Assets/Scenes/Main.unity guid: 3a0b1916be2731d44840741d972ef135 m_configObjects: com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} diff --git a/Client/UserSettings/Layouts/default-6000.dwlt b/Client/UserSettings/Layouts/default-6000.dwlt index 4e7f1db..5667469 100644 --- a/Client/UserSettings/Layouts/default-6000.dwlt +++ b/Client/UserSettings/Layouts/default-6000.dwlt @@ -302,8 +302,8 @@ MonoBehaviour: m_TextWithWhitespace: "Game\u200B" m_Pos: serializedVersion: 2 - x: 1920 - y: 84 + x: 0 + y: 24 width: 528 height: 915 m_SerializedDataModeController: @@ -1152,8 +1152,8 @@ MonoBehaviour: m_TextWithWhitespace: "Hierarchy\u200B" m_Pos: serializedVersion: 2 - x: 2449 - y: 84 + x: 1 + y: 24 width: 438 height: 430 m_SerializedDataModeController: @@ -1218,8 +1218,8 @@ MonoBehaviour: m_TextWithWhitespace: "Console\u200B" m_Pos: serializedVersion: 2 - x: 2449 - y: 540 + x: 1 + y: 480 width: 438 height: 459 m_SerializedDataModeController: @@ -1254,8 +1254,8 @@ MonoBehaviour: m_TextWithWhitespace: "Project\u200B" m_Pos: serializedVersion: 2 - x: 2889 - y: 84 + x: 970 + y: 24 width: 282 height: 915 m_SerializedDataModeController: @@ -1297,7 +1297,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: e48c0000 m_LastClickedID: 36068 - m_ExpandedIDs: 00000000b8bc0000bebc000074be000076be000078be00007abe00007cbe00007ebe000080be000082be000084be000086be000088be00008abe00008cbe00008ebe000090be000092be000094be000096be000098be00009abe00009cbe00009ebe0000a0be0000a2be0000a4be0000a6be0000a8be0000aabe0000acbe0000aebe0000b0be0000b2be0000b4be0000b6be0000b8be0000babe0000bcbe0000bebe0000c0be0000c2be0000c4be0000c6be0000c8be0000cabe0000ccbe0000cebe0000d0be0000d2be0000d4be0000d6be0000d8be0000dabe0000dcbe0000debe0000e0be0000e2be0000e4be0000e6be0000e8be0000eabe0000ecbe0000eebe0000f0be0000f2be0000f4be0000f6be0000f8be0000fabe0000fcbe0000febe000000bf000002bf000004bf000006bf000008bf00000abf00000cbf00000ebf000010bf000012bf000014bf000016bf000018bf00001abf00001cbf00001ebf000020bf000022bf000024bf000026bf000028bf00002abf00002cbf00002ebf000030bf000032bf000034bf000036bf000038bf00003abf00003cbf00003ebf000040bf000042bf000044bf000046bf000048bf00004abf00004cbf00004ebf000050bf000052bf000054bf000056bf000058bf00005abf00005cbf00005ebf000060bf000062bf000064bf000066bf000068bf00006abf00006cbf00006ebf000070bf000072bf000074bf000076bf000078bf00007abf00007cbf00007ebf000080bf000082bf000084bf000086bf000088bf00008abf00008cbf00008ebf000090bf000092bf000094bf000096bf000098bf00009abf00009cbf00009ebf0000a0bf0000a2bf0000a4bf0000a6bf0000a8bf0000aabf0000acbf0000aebf0000b0bf0000b2bf0000b4bf0000b6bf0000b8bf0000babf0000bcbf0000bebf0000c0bf0000c2bf0000c4bf0000c6bf0000c8bf0000cabf0000ccbf0000cebf0000d0bf0000d2bf0000d4bf0000d6bf0000d8bf0000 + m_ExpandedIDs: m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1326,7 +1326,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: ffffffff00000000b8bc0000bebc000074be000076be000078be00007abe00007cbe00007ebe000080be000082be000084be000086be000088be00008abe00008cbe00008ebe000090be000092be000094be000096be000098be00009abe00009cbe00009ebe0000a0be0000a2be0000a4be0000a6be0000a8be0000aabe0000acbe0000aebe0000b0be0000b2be0000b4be0000b6be0000b8be0000babe0000bcbe0000bebe0000c0be0000c2be0000c4be0000c6be0000c8be0000cabe0000ccbe0000cebe0000d0be0000d2be0000d4be0000d6be0000d8be0000dabe0000dcbe0000debe0000e0be0000e2be0000e4be0000e6be0000e8be0000eabe0000ecbe0000eebe0000f0be0000f2be0000f4be0000f6be0000f8be0000fabe0000fcbe0000febe000000bf000002bf000004bf000006bf000008bf00000abf00000cbf00000ebf000010bf000012bf000014bf000016bf000018bf00001abf00001cbf00001ebf000020bf000022bf000024bf000026bf000028bf00002abf00002cbf00002ebf000030bf000032bf000034bf000036bf000038bf00003abf00003cbf00003ebf000040bf000042bf000044bf000046bf000048bf00004abf00004cbf00004ebf000050bf000052bf000054bf000056bf000058bf00005abf00005cbf00005ebf000060bf000062bf000066bf000068bf00006abf00006cbf00006ebf000070bf000072bf000074bf000076bf000078bf00007abf00007cbf00007ebf000080bf000082bf000084bf000086bf000088bf00008abf00008cbf00008ebf000090bf000092bf000094bf000098bf00009abf00009cbf0000a0bf0000a2bf0000a4bf0000a6bf0000a8bf0000aabf0000acbf0000aebf0000b0bf0000b2bf0000b4bf0000b6bf0000b8bf0000babf0000bcbf0000bebf0000c0bf0000c2bf0000c4bf0000c6bf0000c8bf0000cabf0000ccbf0000cebf0000d0bf0000d4bf0000d6bf0000d8bf0000a2c00000a4c00000b2c00000bac00000c0c00000aec50000 + m_ExpandedIDs: m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1405,8 +1405,8 @@ MonoBehaviour: m_TextWithWhitespace: "Inspector\u200B" m_Pos: serializedVersion: 2 - x: 3173 - y: 84 + x: 1254 + y: 24 width: 666 height: 915 m_SerializedDataModeController: