Exemple #1
0
 public TreeItem(AssetBundleData.AssetTreeItemData d, int depth) : base(d == null ? 0 : d.id, depth, d == null ? string.Empty : d.displayName)
 {
     data = d;
     if (data.assetInfo.type == AssetBundleData.AssetInfo.Type.Asset)
     {
         icon = AssetDatabase.GetCachedIcon(data.assetInfo.assetName) as Texture2D;
     }
     else if (data.assetInfo.type == AssetBundleData.AssetInfo.Type.Bundle)
     {
         if (data.assetInfo.isVariant)
         {
             icon = AssetDatabase.GetCachedIcon("Assets/UnityEngine.AssetBundles/Editor/AssetBundleBrowser/variant.png") as Texture2D;
         }
         else
         {
             icon = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName) as Texture2D;
         }
     }
 }
Exemple #2
0
        private void CreateAssetItem(AssetBundleData.AssetTreeItemData itemData, int depth, IList <TreeViewItem> rows)
        {
            var assetItem = new TreeItem(itemData, depth);

            rows.Add(assetItem);
            if (IsExpanded(assetItem.id))
            {
                foreach (var dep in itemData.children)
                {
                    CreateAssetItem(dep, depth + 1, rows);
                }
            }
            else
            {
                if (itemData.children.Count > 0)
                {
                    assetItem.children = CreateChildListForCollapsedParent();
                }
            }
        }