From 85fe1f2485d33a81ab53a5356f9ed4dae772c694 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sun, 13 Mar 2022 20:16:52 +0800 Subject: [PATCH] Update AssetBundleBrowser --- .../AssetBundleBrowser.uxml | 7 + .../AssetBundleBrowser.uxml.meta | 10 + .../AssetBundleBrowserWindow.cs | 110 ++++++- .../AssetBundleBrowserWindow.cs.meta | 2 +- .../AssetBundleBrowser/VisualViewers.meta | 8 + .../VisualViewers/AssetListViewer.cs | 241 ++++++++++++++ .../VisualViewers/AssetListViewer.cs.meta | 11 + .../VisualViewers/AssetListViewer.uxml | 18 ++ .../VisualViewers/AssetListViewer.uxml.meta | 10 + .../VisualViewers/BundleListViewer.cs | 294 ++++++++++++++++++ .../VisualViewers/BundleListViewer.cs.meta | 11 + .../VisualViewers/BundleListViewer.uxml | 22 ++ .../VisualViewers/BundleListViewer.uxml.meta | 10 + 13 files changed, 751 insertions(+), 3 deletions(-) create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListViewer.cs create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListViewer.cs.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListViewer.uxml create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/AssetListViewer.uxml.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListViewer.cs create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListViewer.cs.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListViewer.uxml create mode 100644 Assets/YooAsset/Editor/AssetBundleBrowser/VisualViewers/BundleListViewer.uxml.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml new file mode 100644 index 0000000..d341c94 --- /dev/null +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta new file mode 100644 index 0000000..0e313aa --- /dev/null +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9052b72c383e95043a0c7e7f369b1ad7 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} diff --git a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs index 13d11f1..b54eefe 100644 --- a/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowserWindow.cs @@ -1,11 +1,117 @@ -using System.Collections; +using System.IO; +using System.Linq; using System.Collections.Generic; +using UnityEditor; +using UnityEngine; using UnityEditor.UIElements; +using UnityEngine.UIElements; namespace YooAsset.Editor { - public class AssetBundleBrowserWindow + public class AssetBundleBrowserWindow : EditorWindow { + [MenuItem("YooAsset/AssetBundle Browser", false, 103)] + public static void ShowExample() + { + AssetBundleBrowserWindow wnd = GetWindow(); + wnd.titleContent = new GUIContent("资源包浏览工具"); + wnd.minSize = new Vector2(800, 600); + } + private enum EShowMode + { + AssetList, + BundleList, + } + + private ToolbarMenu _showModeMenu; + private AssetListViewer _assetListViewer; + private BundleListViewer _bundleListViewer; + + private EShowMode _showMode; + private string _searchKeyWord; + private PatchManifest _manifest; + + + public void CreateGUI() + { + VisualElement root = this.rootVisualElement; + + // 加载布局文件 + string uxml = "Assets/YooAsset/Editor/AssetBundleBrowser/AssetBundleBrowser.uxml"; + var visualAsset = AssetDatabase.LoadAssetAtPath(uxml); + if (visualAsset == null) + { + Debug.LogError($"Not found AssetBundleBrowser.uxml : {uxml}"); + return; + } + visualAsset.CloneTree(root); + + // 导入按钮 + var importBtn = root.Q