Update AssetBundleBrowser

pull/4/head
hevinci 2022-03-16 00:01:09 +08:00
parent 6bd48845d2
commit f059aacbf8
4 changed files with 13 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:Toolbar name="Toolbar" style="display: flex;">
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ShowModeMenu" text="ShowMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarPopupSearchField focusable="true" name="SearchField" style="flex-grow: 1; width: 300px;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="width: 300px; flex-grow: 1;" />
<ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
</uie:Toolbar>
</ui:UXML>

View File

@ -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<VisualTreeAsset>(uxml);
if (visualAsset == null)
{
@ -68,7 +69,7 @@ namespace YooAsset.Editor
_showModeMenu.menu.AppendAction(EShowMode.BundleList.ToString(), ShowModeMenuAction2);
// 搜索栏
var searchField = root.Q<ToolbarPopupSearchField>("SearchField");
var searchField = root.Q<ToolbarSearchField>("SearchField");
searchField.RegisterValueChangedCallback(OnSearchKeyWordChange);
// 加载页面
@ -99,9 +100,12 @@ namespace YooAsset.Editor
private void OnSearchKeyWordChange(ChangeEvent<string> e)
{
_searchKeyWord = e.newValue;
if(_manifest != null)
{
_assetListViewer.FillViewData(_manifest, _searchKeyWord);
_bundleListViewer.FillViewData(_manifest, _searchKeyWord);
}
}
private void ShowModeMenuAction1(DropdownMenuAction action)
{
if (_showMode != EShowMode.AssetList)

View File

@ -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<VisualTreeAsset>(uxml);
if (_visualAsset == null)
{

View File

@ -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<VisualTreeAsset>(uxml);
if (_visualAsset == null)
{