Update AssetBundleBrowser

pull/4/head
hevinci 2022-03-16 11:03:05 +08:00
parent 8597b97779
commit d0dc6ba9c6
2 changed files with 52 additions and 0 deletions

View File

@ -14,6 +14,12 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private ToolbarButton _topBar1;
private ToolbarButton _topBar2;
private ToolbarButton _topBar3;
private ToolbarButton _bottomBar1;
private ToolbarButton _bottomBar2;
private ToolbarButton _bottomBar3;
private ListView _assetListView;
private ListView _dependListView;
private PatchManifest _manifest;
@ -35,6 +41,19 @@ namespace YooAsset.Editor
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar3 = _root.Q<ToolbarButton>("TopBar3");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
_topBar3.clicked += TopBar3_clicked;
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
_bottomBar2 = _root.Q<ToolbarButton>("BottomBar2");
_bottomBar3 = _root.Q<ToolbarButton>("BottomBar3");
// 资源列表
_assetListView = _root.Q<ListView>("TopListView");
_assetListView.makeItem = MakeAssetListViewItem;
@ -59,6 +78,7 @@ namespace YooAsset.Editor
_manifest = manifest;
_assetListView.Clear();
_assetListView.itemsSource = FilterViewItems(manifest, searchKeyWord);
_topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
}
private List<PatchAsset> FilterViewItems(PatchManifest manifest, string searchKeyWord)
{
@ -156,6 +176,15 @@ namespace YooAsset.Editor
FillDependListView(patchAsset);
}
}
private void TopBar1_clicked()
{
}
private void TopBar2_clicked()
{
}
private void TopBar3_clicked()
{
}
// 依赖列表相关
private VisualElement MakeDependListViewItem()
@ -229,6 +258,7 @@ namespace YooAsset.Editor
_dependListView.ClearSelection();
#endif
_dependListView.itemsSource = bundles;
_bottomBar1.text = $"Depend Bundles ({bundles.Count})";
}
private string GetAssetFileSize(string assetPath)

View File

@ -14,6 +14,14 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
private ToolbarButton _topBar1;
private ToolbarButton _topBar2;
private ToolbarButton _topBar3;
private ToolbarButton _topBar4;
private ToolbarButton _topBar5;
private ToolbarButton _bottomBar1;
private ToolbarButton _bottomBar2;
private ToolbarButton _bottomBar3;
private ListView _bundleListView;
private ListView _includeListView;
private PatchManifest _manifest;
@ -35,6 +43,18 @@ namespace YooAsset.Editor
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar3 = _root.Q<ToolbarButton>("TopBar3");
_topBar4 = _root.Q<ToolbarButton>("TopBar4");
_topBar5 = _root.Q<ToolbarButton>("TopBar5");
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
_bottomBar2 = _root.Q<ToolbarButton>("BottomBar2");
_bottomBar3 = _root.Q<ToolbarButton>("BottomBar3");
// 资源包列表
_bundleListView = _root.Q<ListView>("TopListView");
_bundleListView.makeItem = MakeBundleListViewItem;
@ -59,6 +79,7 @@ namespace YooAsset.Editor
_manifest = manifest;
_bundleListView.Clear();
_bundleListView.itemsSource = FilterViewItems(manifest, searchKeyWord);
_topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})";
}
private List<PatchBundle> FilterViewItems(PatchManifest manifest, string searchKeyWord)
{
@ -269,6 +290,7 @@ namespace YooAsset.Editor
_includeListView.ClearSelection();
#endif
_includeListView.itemsSource = containsList;
_bottomBar1.text = $"Include Assets ({containsList.Count})";
}
private string GetAssetFileSize(string assetPath)