Update AssetBundleBrowser

pull/4/head
hevinci 2022-03-15 22:30:46 +08:00
parent 6c0fbdae1f
commit d190bc35b4
9 changed files with 47 additions and 37 deletions

View File

@ -15,19 +15,29 @@ namespace YooAsset.Editor
public static void ShowExample()
{
AssetBundleBrowserWindow wnd = GetWindow<AssetBundleBrowserWindow>();
wnd.titleContent = new GUIContent("栗都관啞응묏야");
wnd.titleContent = new GUIContent("资源包浏览工具");
wnd.minSize = new Vector2(800, 600);
}
/// <summary>
/// 显示模式
/// </summary>
private enum EShowMode
{
/// <summary>
/// 资源对象列表显示模式
/// </summary>
AssetList,
/// <summary>
/// 资源包列表显示模式
/// </summary>
BundleList,
}
private ToolbarMenu _showModeMenu;
private AssetListViewer _assetListViewer;
private BundleListViewer _bundleListViewer;
private AssetListBrowserViewer _assetListViewer;
private BundleListBrowserViewer _bundleListViewer;
private EShowMode _showMode;
private string _searchKeyWord;
@ -38,7 +48,7 @@ namespace YooAsset.Editor
{
VisualElement root = this.rootVisualElement;
// 속潼꼈애匡숭
// 加载布局文件
string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml";
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
if (visualAsset == null)
@ -48,28 +58,28 @@ namespace YooAsset.Editor
}
visualAsset.CloneTree(root);
// 돔흙객큐
// 导入按钮
var importBtn = root.Q<Button>("ImportButton");
importBtn.clicked += ImportBtn_onClick;
// 鞫刻친駕꽉데
// 显示模式菜单
_showModeMenu = root.Q<ToolbarMenu>("ShowModeMenu");
_showModeMenu.menu.AppendAction(EShowMode.AssetList.ToString(), ShowModeMenuAction1);
_showModeMenu.menu.AppendAction(EShowMode.BundleList.ToString(), ShowModeMenuAction2);
// 鎧乞으
// 搜索栏
var searchField = root.Q<ToolbarPopupSearchField>("SearchField");
searchField.RegisterValueChangedCallback(OnSearchKeyWordChange);
// 속潼女충
_assetListViewer = new AssetListViewer();
// 加载页面
_assetListViewer = new AssetListBrowserViewer();
_assetListViewer.InitViewer();
// 속潼女충
_bundleListViewer = new BundleListViewer();
// 加载页面
_bundleListViewer = new BundleListBrowserViewer();
_bundleListViewer.InitViewer();
// 놓迦女충
// 初始页面
_showMode = EShowMode.AssetList;
_showModeMenu.text = EShowMode.AssetList.ToString();
_assetListViewer.AttachParent(root);
@ -77,7 +87,7 @@ namespace YooAsset.Editor
private void ImportBtn_onClick()
{
string selectFilePath = EditorUtility.OpenFilePanel("돔흙껸땀헌데", EditorTools.GetProjectPath(), "bytes");
string selectFilePath = EditorUtility.OpenFilePanel("导入补丁清单", EditorTools.GetProjectPath(), "bytes");
if (string.IsNullOrEmpty(selectFilePath))
return;

View File

@ -9,7 +9,7 @@ using UnityEngine.UIElements;
namespace YooAsset.Editor
{
internal class AssetListViewer
internal class AssetListBrowserViewer
{
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
@ -19,22 +19,22 @@ namespace YooAsset.Editor
private PatchManifest _manifest;
/// <summary>
/// 初始化页面
/// 初始化页面
/// </summary>
public void InitViewer()
{
// 加载布局文件
string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListViewer.uxml";
// 加载布局文件
string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListBrowserViewer.uxml";
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetListViewer)}.uxml : {uxml}");
Debug.LogError($"Not found {nameof(AssetListBrowserViewer)}.uxml : {uxml}");
return;
}
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 资源列表
// 资源列表
_assetListView = _root.Q<ListView>("TopListView");
_assetListView.makeItem = MakeAssetListViewItem;
_assetListView.bindItem = BindAssetListViewItem;
@ -44,14 +44,14 @@ namespace YooAsset.Editor
#else
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
#endif
// 依赖列表
// 依赖列表
_dependListView = _root.Q<ListView>("BottomListView");
_dependListView.makeItem = MakeDependListViewItem;
_dependListView.bindItem = BindDependListViewItem;
}
/// <summary>
/// 填充页面数据
/// 填充页面数据
/// </summary>
public void FillViewData(PatchManifest manifest, string searchKeyWord)
{
@ -75,7 +75,7 @@ namespace YooAsset.Editor
}
/// <summary>
/// 挂接到父类页面上
/// 挂接到父类页面上
/// </summary>
public void AttachParent(VisualElement parent)
{
@ -83,7 +83,7 @@ namespace YooAsset.Editor
}
/// <summary>
/// 从父类页面脱离开
/// 从父类页面脱离开
/// </summary>
public void DetachParent()
{
@ -91,7 +91,7 @@ namespace YooAsset.Editor
}
// 资源列表相关
// 资源列表相关
private VisualElement MakeAssetListViewItem()
{
VisualElement element = new VisualElement();
@ -156,7 +156,7 @@ namespace YooAsset.Editor
}
}
// 依赖列表相关
// 依赖列表相关
private VisualElement MakeDependListViewItem()
{
VisualElement element = new VisualElement();

View File

@ -9,7 +9,7 @@ using UnityEngine.UIElements;
namespace YooAsset.Editor
{
internal class BundleListViewer
internal class BundleListBrowserViewer
{
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
@ -19,22 +19,22 @@ namespace YooAsset.Editor
private PatchManifest _manifest;
/// <summary>
/// 初始化页面
/// 初始化页面
/// </summary>
public void InitViewer()
{
// 加载布局文件
string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListViewer.uxml";
// 加载布局文件
string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListBrowserViewer.uxml";
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(BundleListViewer)}.uxml : {uxml}");
Debug.LogError($"Not found {nameof(BundleListBrowserViewer)}.uxml : {uxml}");
return;
}
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 资源包列表
// 资源包列表
_bundleListView = _root.Q<ListView>("TopListView");
_bundleListView.makeItem = MakeBundleListViewItem;
_bundleListView.bindItem = BindBundleListViewItem;
@ -44,14 +44,14 @@ namespace YooAsset.Editor
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
#endif
// 包含列表
// 包含列表
_includeListView = _root.Q<ListView>("BottomListView");
_includeListView.makeItem = MakeContainsListViewItem;
_includeListView.bindItem = BindContainsListViewItem;
}
/// <summary>
/// 填充页面数据
/// 填充页面数据
/// </summary>
public void FillViewData(PatchManifest manifest, string searchKeyWord)
{
@ -75,7 +75,7 @@ namespace YooAsset.Editor
}
/// <summary>
/// 挂接到父类页面上
/// 挂接到父类页面上
/// </summary>
public void AttachParent(VisualElement parent)
{
@ -83,7 +83,7 @@ namespace YooAsset.Editor
}
/// <summary>
/// 从父类页面脱离开
/// 从父类页面脱离开
/// </summary>
public void DetachParent()
{
@ -91,7 +91,7 @@ namespace YooAsset.Editor
}
// 资源列表相关
// 资源列表相关
private VisualElement MakeBundleListViewItem()
{
VisualElement element = new VisualElement();
@ -183,7 +183,7 @@ namespace YooAsset.Editor
}
}
// 依赖列表相关
// 依赖列表相关
private VisualElement MakeContainsListViewItem()
{
VisualElement element = new VisualElement();