/// <summary> /// 绘制AssetNode的详细信息 /// </summary> /// <param name="assetNode">AssetNode数据</param> /// <param name="showMainBundle">是否显示其所在的Bundle</param> /// <param name="showDependBundle">是否显示依赖的Bundle</param> private void DrawAssetNode(AssetNode assetNode, bool showMainBundle = false, bool showDependBundle = false) { dynamic assetNodeDynamic = assetNode.AsDynamic(); string assetPath = assetNodeDynamic.m_AssetPath; bool isDone = assetNodeDynamic.IsDone; bool isAlive = assetNodeDynamic.IsAlive(); int loadCount = assetNodeDynamic.m_LoadCount; List <WeakReference> weakAssets = assetNodeDynamic.m_WeakAssets; EditorGUIUtil.BeginGUIBackgroundColor(m_NodeBGColor); { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUIUtil.BeginGUIColor(Color.white); { EditorGUIUtil.BeginIndent(); { EditorGUILayout.LabelField("Asset Node:"); EditorGUIUtil.BeginIndent(); { EditorGUILayout.LabelField($"Asset Path:{assetPath}{(isDone?"":" (Loading)")}"); EditorGUILayout.LabelField($"Is Alive:{isAlive}"); EditorGUILayout.LabelField($"Load Count:{loadCount}"); if (weakAssets.Count > 0) { EditorGUILayout.LabelField("Weak Ref:"); EditorGUIUtil.BeginIndent(); { foreach (var weakRef in weakAssets) { if (!UnityObjectExtension.IsNull(weakRef.Target)) { UnityObject uObj = weakRef.Target as UnityObject; EditorGUILayout.LabelField($"Name:{uObj.name}"); } } } EditorGUIUtil.EndIndent(); } } EditorGUIUtil.EndIndent(); if (showMainBundle || showDependBundle) { BundleNode mainBundleNode = assetNodeDynamic.m_BundleNode; string mainBundlePath = mainBundleNode.AsDynamic().m_BundlePath; EditorGUILayout.LabelField("Bundle Node:"); EditorGUIUtil.BeginIndent(); { if (showMainBundle) { EditorGUILayout.LabelField("Main Bundle:"); EditorGUIUtil.BeginIndent(); { DrawBundleNode(mainBundleNode); } EditorGUIUtil.EndIndent(); } if (showDependBundle) { EditorGUILayout.LabelField("Depend Bundle:"); string[] depends = m_AssetBundleManifest.GetAllDependencies(mainBundlePath); EditorGUIUtil.BeginIndent(); { foreach (var depend in depends) { BundleNode dependNode = m_BundleNodeDic[depend]; DrawBundleNode(dependNode); EditorGUILayout.Space(); } } EditorGUIUtil.EndIndent(); } } EditorGUIUtil.EndIndent(); } } EditorGUIUtil.EndIndent(); } EditorGUIUtil.EndGUIColor(); } EditorGUILayout.EndVertical(); } EditorGUIUtil.EndGUIBackgroundColor(); }