diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs index b1ca04c..4e20257 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs @@ -24,22 +24,7 @@ namespace YooAsset.Editor /// private static void LoadSettingData() { - // 加载配置文件 - string settingFilePath = $"{EditorTools.GetYooAssetSettingPath()}/{nameof(AssetBundleBuilderSetting)}.asset"; - _setting = AssetDatabase.LoadAssetAtPath(settingFilePath); - if (_setting == null) - { - Debug.LogWarning($"Create new {nameof(AssetBundleBuilderSetting)}.asset : {settingFilePath}"); - _setting = ScriptableObject.CreateInstance(); - EditorTools.CreateFileDirectory(settingFilePath); - AssetDatabase.CreateAsset(Setting, settingFilePath); - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - } - else - { - Debug.Log($"Load {nameof(AssetBundleBuilderSetting)}.asset ok"); - } + _setting = YooAssetEditorSettingsHelper.LoadSettingData(); } /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs index a8fe46e..eade0ec 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs @@ -32,21 +32,19 @@ namespace YooAsset.Editor public void CreateGUI() { - VisualElement root = this.rootVisualElement; - - // 加载布局文件 - string rootPath = EditorTools.GetYooAssetSourcePath(); - string uxml = $"{rootPath}/Editor/AssetBundleBuilder/{nameof(AssetBundleBuilderWindow)}.uxml"; - var visualAsset = AssetDatabase.LoadAssetAtPath(uxml); - if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleBuilderWindow)}.uxml : {uxml}"); - return; - } - visualAsset.CloneTree(root); - try { + VisualElement root = this.rootVisualElement; + + // 加载布局文件 + var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleBuilderUXML; + if (visualAsset == null) + { + Debug.LogError($"Not found {nameof(AssetBundleBuilderWindow)}.uxml in settings."); + return; + } + visualAsset.CloneTree(root); + _buildTarget = EditorUserBuildSettings.activeBuildTarget; _encryptionServicesClassTypes = GetEncryptionServicesClassTypes(); _encryptionServicesClassNames = _encryptionServicesClassTypes.Select(t => t.FullName).ToList(); diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index 96ecea2..26c664a 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -105,22 +105,7 @@ namespace YooAsset.Editor /// private static void LoadSettingData() { - // 加载配置文件 - string settingFilePath = $"{EditorTools.GetYooAssetSettingPath()}/{nameof(AssetBundleCollectorSetting)}.asset"; - _setting = AssetDatabase.LoadAssetAtPath(settingFilePath); - if (_setting == null) - { - Debug.LogWarning($"Create new {nameof(AssetBundleCollectorSetting)}.asset : {settingFilePath}"); - _setting = ScriptableObject.CreateInstance(); - EditorTools.CreateFileDirectory(settingFilePath); - AssetDatabase.CreateAsset(Setting, settingFilePath); - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - } - else - { - Debug.Log($"Load {nameof(AssetBundleCollectorSetting)}.asset ok"); - } + _setting = YooAssetEditorSettingsHelper.LoadSettingData(); // IPackRule { diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index b7afdba..b379771 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -37,8 +37,6 @@ namespace YooAsset.Editor Undo.undoRedoPerformed -= RefreshWindow; Undo.undoRedoPerformed += RefreshWindow; - VisualElement root = this.rootVisualElement; - _collectorTypeList = new List() { $"{nameof(ECollectorType.MainAssetCollector)}", @@ -49,19 +47,19 @@ namespace YooAsset.Editor _packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames(); _filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames(); - // 加载布局文件 - string rootPath = EditorTools.GetYooAssetSourcePath(); - string uxml = $"{rootPath}/Editor/AssetBundleCollector/{nameof(AssetBundleCollectorWindow)}.uxml"; - var visualAsset = AssetDatabase.LoadAssetAtPath(uxml); - if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleCollectorWindow)}.uxml : {uxml}"); - return; - } - visualAsset.CloneTree(root); - try { + VisualElement root = this.rootVisualElement; + + // 加载布局文件 + var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleCollectorUXML; + if (visualAsset == null) + { + Debug.LogError($"Not found {nameof(AssetBundleCollectorWindow)}.uxml in settings."); + return; + } + visualAsset.CloneTree(root); + // 导入导出按钮 var exportBtn = root.Q