From f059aacbf8833af97beeebd8ab34f0baa12593fe Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 16 Mar 2022 00:01:09 +0800 Subject: [PATCH] Update AssetBundleBrowser --- .../AssetBundleBrowser/AssetBundleBrowser.uxml | 2 +- .../AssetBundleBrowser/AssetBundleBrowserWindow.cs | 12 ++++++++---- .../VisualViewers/AssetListBrowserViewer.cs | 3 ++- .../VisualViewers/BundleListBrowserViewer.cs | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml index d341c94..86a1d3f 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml @@ -1,7 +1,7 @@ - + diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs index 839b2c4..ffbfd71 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs @@ -49,7 +49,8 @@ namespace YooAsset.Editor VisualElement root = this.rootVisualElement; // 加载布局文件 - string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml"; + string rootPath = EditorTools.GetYooAssetPath(); + string uxml = $"{rootPath}/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml"; var visualAsset = AssetDatabase.LoadAssetAtPath(uxml); if (visualAsset == null) { @@ -68,7 +69,7 @@ namespace YooAsset.Editor _showModeMenu.menu.AppendAction(EShowMode.BundleList.ToString(), ShowModeMenuAction2); // 搜索栏 - var searchField = root.Q("SearchField"); + var searchField = root.Q("SearchField"); searchField.RegisterValueChangedCallback(OnSearchKeyWordChange); // 加载页面 @@ -99,8 +100,11 @@ namespace YooAsset.Editor private void OnSearchKeyWordChange(ChangeEvent e) { _searchKeyWord = e.newValue; - _assetListViewer.FillViewData(_manifest, _searchKeyWord); - _bundleListViewer.FillViewData(_manifest, _searchKeyWord); + if(_manifest != null) + { + _assetListViewer.FillViewData(_manifest, _searchKeyWord); + _bundleListViewer.FillViewData(_manifest, _searchKeyWord); + } } private void ShowModeMenuAction1(DropdownMenuAction action) { diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs b/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs index 9958cee..4094581 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.cs @@ -24,7 +24,8 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.uxml"; + string rootPath = EditorTools.GetYooAssetPath(); + string uxml = $"{rootPath}/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.uxml"; _visualAsset = AssetDatabase.LoadAssetAtPath(uxml); if (_visualAsset == null) { diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.cs b/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.cs index 6849eb5..bba4a88 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.cs @@ -24,7 +24,8 @@ namespace YooAsset.Editor public void InitViewer() { // 加载布局文件 - string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.uxml"; + string rootPath = EditorTools.GetYooAssetPath(); + string uxml = $"{rootPath}/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.uxml"; _visualAsset = AssetDatabase.LoadAssetAtPath(uxml); if (_visualAsset == null) {