From a906a84721fadb0e5ed48646ba2078e93ff9fb43 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sun, 22 May 2022 00:39:22 +0800 Subject: [PATCH] Optimized the loading method of the setting file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化了配置文件的加载方式和途径。 --- .../AssetBundleBuilderSettingData.cs | 2 +- .../AssetBundleBuilderWindow.cs | 6 +- .../AssetBundleCollectorSettingData.cs | 2 +- .../AssetBundleCollectorWindow.cs | 6 +- .../AssetBundleDebuggerWindow.cs | 6 +- .../VisualViewers/DebuggerAssetListViewer.cs | 6 +- .../VisualViewers/DebuggerBundleListViewer.cs | 8 +- .../AssetBundleReporterWindow.cs | 6 +- .../VisualViewers/ReporterAssetListViewer.cs | 50 +++++------ .../VisualViewers/ReporterBundleListViewer.cs | 60 ++++++-------- .../VisualViewers/ReporterSummaryViewer.cs | 6 +- Assets/YooAsset/Editor/EditorHelper.cs | 83 +++++++++++++++++++ ...ngsHelper.cs.meta => EditorHelper.cs.meta} | 0 .../ShaderVariantCollectorSettingData.cs | 2 +- .../Editor/YooAssetEditorSettings.asset | 32 ------- .../Editor/YooAssetEditorSettings.asset.meta | 8 -- .../YooAsset/Editor/YooAssetEditorSettings.cs | 25 ------ .../Editor/YooAssetEditorSettings.cs.meta | 11 --- .../Editor/YooAssetEditorSettingsData.cs | 35 -------- .../Editor/YooAssetEditorSettingsData.cs.meta | 11 --- .../Editor/YooAssetEditorSettingsHelper.cs | 36 -------- 21 files changed, 146 insertions(+), 255 deletions(-) create mode 100644 Assets/YooAsset/Editor/EditorHelper.cs rename Assets/YooAsset/Editor/{YooAssetEditorSettingsHelper.cs.meta => EditorHelper.cs.meta} (100%) delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettings.asset delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettings.asset.meta delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettings.cs delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettings.cs.meta delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs.meta delete mode 100644 Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs index 4e20257..4ef6a00 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSettingData.cs @@ -24,7 +24,7 @@ namespace YooAsset.Editor /// private static void LoadSettingData() { - _setting = YooAssetEditorSettingsHelper.LoadSettingData(); + _setting = EditorHelper.LoadSettingData(); } /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs index a594dbb..1c5c11f 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs @@ -38,12 +38,10 @@ namespace YooAsset.Editor VisualElement root = this.rootVisualElement; // 加载布局文件 - var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleBuilderUXML; + var visualAsset = EditorHelper.LoadWindowUXML(); if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleBuilderWindow)}.uxml in settings."); return; - } + visualAsset.CloneTree(root); _buildTarget = EditorUserBuildSettings.activeBuildTarget; diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index 26c664a..6d1d158 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -105,7 +105,7 @@ namespace YooAsset.Editor /// private static void LoadSettingData() { - _setting = YooAssetEditorSettingsHelper.LoadSettingData(); + _setting = EditorHelper.LoadSettingData(); // IPackRule { diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index fa010ef..7f82adb 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -54,12 +54,10 @@ namespace YooAsset.Editor VisualElement root = this.rootVisualElement; // 加载布局文件 - var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleCollectorUXML; + var visualAsset = EditorHelper.LoadWindowUXML(); if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleCollectorWindow)}.uxml in settings."); return; - } + visualAsset.CloneTree(root); // 导入导出按钮 diff --git a/Assets/YooAsset/Editor/AssetBundleDebugger/AssetBundleDebuggerWindow.cs b/Assets/YooAsset/Editor/AssetBundleDebugger/AssetBundleDebuggerWindow.cs index d582426..3886641 100644 --- a/Assets/YooAsset/Editor/AssetBundleDebugger/AssetBundleDebuggerWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleDebugger/AssetBundleDebuggerWindow.cs @@ -53,12 +53,10 @@ namespace YooAsset.Editor VisualElement root = rootVisualElement; // 加载布局文件 - var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleDebuggerUXML; + var visualAsset = EditorHelper.LoadWindowUXML(); if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleDebuggerWindow)}.uxml in settings."); return; - } + visualAsset.CloneTree(root); // 采样按钮 diff --git a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs index ff7df91..8c41684 100644 --- a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs @@ -24,12 +24,10 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - _visualAsset = YooAssetEditorSettingsData.Setting.DebuggerAssetListViewerUXML; + _visualAsset = EditorHelper.LoadWindowUXML(); if (_visualAsset == null) - { - Debug.LogError($"Not found {nameof(DebuggerAssetListViewer)}.uxml in settings."); return; - } + _root = _visualAsset.CloneTree(); _root.style.flexGrow = 1f; diff --git a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs index a47cc81..5122a81 100644 --- a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs @@ -24,12 +24,10 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - _visualAsset = YooAssetEditorSettingsData.Setting.DebuggerBundleListViewerUXML; + _visualAsset = EditorHelper.LoadWindowUXML(); if (_visualAsset == null) - { - Debug.LogError($"Not found {nameof(DebuggerBundleListViewer)}.uxml in settings."); return; - } + _root = _visualAsset.CloneTree(); _root.style.flexGrow = 1f; @@ -37,12 +35,12 @@ namespace YooAsset.Editor _bundleListView = _root.Q("TopListView"); _bundleListView.makeItem = MakeAssetListViewItem; _bundleListView.bindItem = BindAssetListViewItem; - #if UNITY_2020_1_OR_NEWER _bundleListView.onSelectionChange += BundleListView_onSelectionChange; #else _bundleListView.onSelectionChanged += BundleListView_onSelectionChange; #endif + // 使用列表 _usingListView = _root.Q("BottomListView"); _usingListView.makeItem = MakeIncludeListViewItem; diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs index b63bcb3..d084242 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/AssetBundleReporterWindow.cs @@ -55,12 +55,10 @@ namespace YooAsset.Editor VisualElement root = this.rootVisualElement; // 加载布局文件 - var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleReporterUXML; + var visualAsset = EditorHelper.LoadWindowUXML(); if (visualAsset == null) - { - Debug.LogError($"Not found {nameof(AssetBundleReporterWindow)}.uxml in settings."); return; - } + visualAsset.CloneTree(root); // 导入按钮 diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs index d12c24a..48f95a7 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs @@ -38,46 +38,36 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - _visualAsset = YooAssetEditorSettingsData.Setting.ReporterAssetListViewerUXML; + _visualAsset = EditorHelper.LoadWindowUXML(); if (_visualAsset == null) - { - Debug.LogError($"Not found {nameof(ReporterAssetListViewer)}.uxml in settings."); return; - } - try - { - _root = _visualAsset.CloneTree(); - _root.style.flexGrow = 1f; + _root = _visualAsset.CloneTree(); + _root.style.flexGrow = 1f; - // 顶部按钮栏 - _topBar1 = _root.Q("TopBar1"); - _topBar2 = _root.Q("TopBar2"); - _topBar1.clicked += TopBar1_clicked; - _topBar2.clicked += TopBar2_clicked; + // 顶部按钮栏 + _topBar1 = _root.Q("TopBar1"); + _topBar2 = _root.Q("TopBar2"); + _topBar1.clicked += TopBar1_clicked; + _topBar2.clicked += TopBar2_clicked; - // 底部按钮栏 - _bottomBar1 = _root.Q("BottomBar1"); + // 底部按钮栏 + _bottomBar1 = _root.Q("BottomBar1"); - // 资源列表 - _assetListView = _root.Q("TopListView"); - _assetListView.makeItem = MakeAssetListViewItem; - _assetListView.bindItem = BindAssetListViewItem; + // 资源列表 + _assetListView = _root.Q("TopListView"); + _assetListView.makeItem = MakeAssetListViewItem; + _assetListView.bindItem = BindAssetListViewItem; #if UNITY_2020_1_OR_NEWER - _assetListView.onSelectionChange += AssetListView_onSelectionChange; + _assetListView.onSelectionChange += AssetListView_onSelectionChange; #else - _assetListView.onSelectionChanged += AssetListView_onSelectionChange; + _assetListView.onSelectionChanged += AssetListView_onSelectionChange; #endif - // 依赖列表 - _dependListView = _root.Q("BottomListView"); - _dependListView.makeItem = MakeDependListViewItem; - _dependListView.bindItem = BindDependListViewItem; - } - catch (Exception e) - { - Debug.LogError(e.ToString()); - } + // 依赖列表 + _dependListView = _root.Q("BottomListView"); + _dependListView.makeItem = MakeDependListViewItem; + _dependListView.bindItem = BindDependListViewItem; } /// diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs index e72e4b4..afd4d7f 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs @@ -42,56 +42,46 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - _visualAsset = YooAssetEditorSettingsData.Setting.ReporterBundleListViewerUXML; + _visualAsset = EditorHelper.LoadWindowUXML(); if (_visualAsset == null) - { - Debug.LogError($"Not found {nameof(ReporterBundleListViewer)}.uxml in settings."); return; - } - try - { - _root = _visualAsset.CloneTree(); - _root.style.flexGrow = 1f; + _root = _visualAsset.CloneTree(); + _root.style.flexGrow = 1f; - // 顶部按钮栏 - _topBar1 = _root.Q("TopBar1"); - _topBar2 = _root.Q("TopBar2"); - _topBar3 = _root.Q("TopBar3"); - _topBar4 = _root.Q("TopBar4"); - _topBar1.clicked += TopBar1_clicked; - _topBar2.clicked += TopBar2_clicked; - _topBar3.clicked += TopBar3_clicked; - _topBar4.clicked += TopBar4_clicked; + // 顶部按钮栏 + _topBar1 = _root.Q("TopBar1"); + _topBar2 = _root.Q("TopBar2"); + _topBar3 = _root.Q("TopBar3"); + _topBar4 = _root.Q("TopBar4"); + _topBar1.clicked += TopBar1_clicked; + _topBar2.clicked += TopBar2_clicked; + _topBar3.clicked += TopBar3_clicked; + _topBar4.clicked += TopBar4_clicked; - // 底部按钮栏 - _bottomBar1 = _root.Q("BottomBar1"); + // 底部按钮栏 + _bottomBar1 = _root.Q("BottomBar1"); - // 资源包列表 - _bundleListView = _root.Q("TopListView"); - _bundleListView.makeItem = MakeBundleListViewItem; - _bundleListView.bindItem = BindBundleListViewItem; + // 资源包列表 + _bundleListView = _root.Q("TopListView"); + _bundleListView.makeItem = MakeBundleListViewItem; + _bundleListView.bindItem = BindBundleListViewItem; #if UNITY_2020_1_OR_NEWER - _bundleListView.onSelectionChange += BundleListView_onSelectionChange; + _bundleListView.onSelectionChange += BundleListView_onSelectionChange; #else - _bundleListView.onSelectionChanged += BundleListView_onSelectionChange; + _bundleListView.onSelectionChanged += BundleListView_onSelectionChange; #endif - // 包含列表 - _includeListView = _root.Q("BottomListView"); - _includeListView.makeItem = MakeIncludeListViewItem; - _includeListView.bindItem = BindIncludeListViewItem; - } - catch (Exception e) - { - Debug.LogError(e.ToString()); - } + // 包含列表 + _includeListView = _root.Q("BottomListView"); + _includeListView.makeItem = MakeIncludeListViewItem; + _includeListView.bindItem = BindIncludeListViewItem; } /// /// 填充页面数据 /// - public void FillViewData( BuildReport buildReport, string reprotFilePath, string searchKeyWord) + public void FillViewData(BuildReport buildReport, string reprotFilePath, string searchKeyWord) { _buildReport = buildReport; _reportFilePath = reprotFilePath; diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs index ce0b3d7..6291c1b 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs @@ -37,12 +37,10 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - _visualAsset = YooAssetEditorSettingsData.Setting.ReporterSummaryViewerUXML; + _visualAsset = EditorHelper.LoadWindowUXML(); if (_visualAsset == null) - { - Debug.LogError($"Not found {nameof(ReporterSummaryViewer)}.uxml in settings."); return; - } + _root = _visualAsset.CloneTree(); _root.style.flexGrow = 1f; diff --git a/Assets/YooAsset/Editor/EditorHelper.cs b/Assets/YooAsset/Editor/EditorHelper.cs new file mode 100644 index 0000000..fd3ce45 --- /dev/null +++ b/Assets/YooAsset/Editor/EditorHelper.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEngine.UIElements; + +namespace YooAsset.Editor +{ + public class EditorHelper + { + private readonly static Dictionary _uxmlDic = new Dictionary(); + + static EditorHelper() + { + // 资源包收集 + _uxmlDic.Add(typeof(AssetBundleCollectorWindow), "355c4ac5cdebddc4c8362bed6f17a79e"); + + // 资源包构建 + _uxmlDic.Add(typeof(AssetBundleBuilderWindow), "28ba29adb4949284e8c48893218b0d9a"); + + // 资源包调试 + _uxmlDic.Add(typeof(AssetBundleDebuggerWindow), "790db12999afd334e8fb6ba70ef0a947"); + _uxmlDic.Add(typeof(DebuggerAssetListViewer), "31c6096c1cb29b4469096b7b4942a322"); + _uxmlDic.Add(typeof(DebuggerBundleListViewer), "932a25ffd05c13c47994d66e9d73bc37"); + + // 构建报告 + _uxmlDic.Add(typeof(AssetBundleReporterWindow), "9052b72c383e95043a0c7e7f369b1ad7"); + _uxmlDic.Add(typeof(ReporterSummaryViewer), "f8929271050855e42a1ccc6b14993a04"); + _uxmlDic.Add(typeof(ReporterAssetListViewer), "5f81bc15a55ee0a49a266f9d71e2372b"); + _uxmlDic.Add(typeof(ReporterBundleListViewer), "56d6dbe0d65ce334a8996beb19612989"); + } + + /// + /// 加载窗口的布局文件 + /// + public static VisualTreeAsset LoadWindowUXML() where TWindow : class + { + var windowType = typeof(TWindow); + if (_uxmlDic.TryGetValue(windowType, out string uxmlGUID)) + { + string assetPath = AssetDatabase.GUIDToAssetPath(uxmlGUID); + if (string.IsNullOrEmpty(assetPath)) + throw new System.Exception($"Invalid YooAsset uxml guid : {uxmlGUID}"); + var visualTreeAsset = AssetDatabase.LoadAssetAtPath(assetPath); + if (visualTreeAsset == null) + throw new System.Exception($"Failed to load {windowType}.uxml"); + return visualTreeAsset; + } + else + { + throw new System.Exception($"Invalid YooAsset window type : {windowType}"); + } + } + + /// + /// 加载相关的配置文件 + /// + public static TSetting LoadSettingData() where TSetting : ScriptableObject + { + var settingType = typeof(TSetting); + var guids = AssetDatabase.FindAssets($"t:{settingType.Name}"); + if (guids.Length == 0) + { + Debug.LogWarning($"Create new {settingType.Name}.asset"); + var setting = ScriptableObject.CreateInstance(); + string filePath = $"Assets/{settingType.Name}.asset"; + AssetDatabase.CreateAsset(setting, filePath); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + return setting; + } + else + { + if (guids.Length != 1) + throw new System.Exception($"Found multiple {settingType.Name} files !"); + + string filePath = AssetDatabase.GUIDToAssetPath(guids[0]); + var setting = AssetDatabase.LoadAssetAtPath(filePath); + return setting; + } + } + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs.meta b/Assets/YooAsset/Editor/EditorHelper.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs.meta rename to Assets/YooAsset/Editor/EditorHelper.cs.meta diff --git a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs index 9663c62..465add8 100644 --- a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs @@ -25,7 +25,7 @@ namespace YooAsset.Editor /// private static void LoadSettingData() { - _setting = YooAssetEditorSettingsHelper.LoadSettingData(); + _setting = EditorHelper.LoadSettingData(); } /// diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettings.asset b/Assets/YooAsset/Editor/YooAssetEditorSettings.asset deleted file mode 100644 index b732c70..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettings.asset +++ /dev/null @@ -1,32 +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: 4eff45040ac501b4fa978c46f72f2e64, type: 3} - m_Name: YooAssetEditorSettings - m_EditorClassIdentifier: - AssetBundleCollectorUXML: {fileID: 9197481963319205126, guid: 355c4ac5cdebddc4c8362bed6f17a79e, - type: 3} - AssetBundleBuilderUXML: {fileID: 9197481963319205126, guid: 28ba29adb4949284e8c48893218b0d9a, - type: 3} - AssetBundleDebuggerUXML: {fileID: 9197481963319205126, guid: 790db12999afd334e8fb6ba70ef0a947, - type: 3} - DebuggerAssetListViewerUXML: {fileID: 9197481963319205126, guid: 31c6096c1cb29b4469096b7b4942a322, - type: 3} - DebuggerBundleListViewerUXML: {fileID: 9197481963319205126, guid: 932a25ffd05c13c47994d66e9d73bc37, - type: 3} - AssetBundleReporterUXML: {fileID: 9197481963319205126, guid: 9052b72c383e95043a0c7e7f369b1ad7, - type: 3} - ReporterSummaryViewerUXML: {fileID: 9197481963319205126, guid: f8929271050855e42a1ccc6b14993a04, - type: 3} - ReporterAssetListViewerUXML: {fileID: 9197481963319205126, guid: 5f81bc15a55ee0a49a266f9d71e2372b, - type: 3} - ReporterBundleListViewerUXML: {fileID: 9197481963319205126, guid: 56d6dbe0d65ce334a8996beb19612989, - type: 3} diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettings.asset.meta b/Assets/YooAsset/Editor/YooAssetEditorSettings.asset.meta deleted file mode 100644 index d8ebb03..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettings.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b0b43f68477734743a5f2fc507b5bda6 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettings.cs b/Assets/YooAsset/Editor/YooAssetEditorSettings.cs deleted file mode 100644 index 983288b..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettings.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; -using UnityEngine.UIElements; - -namespace YooAsset.Editor -{ - public class YooAssetEditorSettings : ScriptableObject - { - // 资源包收集 - public VisualTreeAsset AssetBundleCollectorUXML; - - // 资源包构建 - public VisualTreeAsset AssetBundleBuilderUXML; - - // 资源包调试 - public VisualTreeAsset AssetBundleDebuggerUXML; - public VisualTreeAsset DebuggerAssetListViewerUXML; - public VisualTreeAsset DebuggerBundleListViewerUXML; - - // 构建报告 - public VisualTreeAsset AssetBundleReporterUXML; - public VisualTreeAsset ReporterSummaryViewerUXML; - public VisualTreeAsset ReporterAssetListViewerUXML; - public VisualTreeAsset ReporterBundleListViewerUXML; - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettings.cs.meta b/Assets/YooAsset/Editor/YooAssetEditorSettings.cs.meta deleted file mode 100644 index 975cd36..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettings.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4eff45040ac501b4fa978c46f72f2e64 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs b/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs deleted file mode 100644 index ee6c7d5..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs +++ /dev/null @@ -1,35 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace YooAsset.Editor -{ - public class YooAssetEditorSettingsData - { - private static YooAssetEditorSettings _setting = null; - public static YooAssetEditorSettings Setting - { - get - { - if (_setting == null) - LoadEditorSettingData(); - return _setting; - } - } - - /// - /// 加载配置文件 - /// - private static void LoadEditorSettingData() - { - var guids = AssetDatabase.FindAssets($"t:{nameof(YooAssetEditorSettings)}", new[] { "Assets", "Packages" }); - if (guids.Length == 0) - throw new System.Exception($"Not found {nameof(YooAssetEditorSettings)} file !"); - if (guids.Length != 1) - throw new System.Exception($"Found multiple {nameof(YooAssetEditorSettings)} files !"); - - string settingFilePath = AssetDatabase.GUIDToAssetPath(guids[0]); - _setting = AssetDatabase.LoadAssetAtPath(settingFilePath); - Debug.Log($"Load {nameof(YooAssetEditorSettings)}.asset ok !"); - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs.meta b/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs.meta deleted file mode 100644 index bc90def..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettingsData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e39f1b67d310bb54e8b1220bcf06afc4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs b/Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs deleted file mode 100644 index 5222cac..0000000 --- a/Assets/YooAsset/Editor/YooAssetEditorSettingsHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace YooAsset.Editor -{ - public class YooAssetEditorSettingsHelper - { - /// - /// 加载相关的配置文件 - /// - public static TSetting LoadSettingData() where TSetting : ScriptableObject - { - var settingType = typeof(TSetting); - var guids = AssetDatabase.FindAssets($"t:{settingType.Name}"); - if (guids.Length == 0) - { - Debug.LogWarning($"Create new {settingType.Name}.asset"); - var setting = ScriptableObject.CreateInstance(); - string filePath = $"Assets/{settingType.Name}.asset"; - AssetDatabase.CreateAsset(setting, filePath); - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - return setting; - } - else - { - if (guids.Length != 1) - throw new System.Exception($"Found multiple {settingType.Name} files !"); - - string filePath = AssetDatabase.GUIDToAssetPath(guids[0]); - var setting = AssetDatabase.LoadAssetAtPath(filePath); - return setting; - } - } - } -} \ No newline at end of file