private void CellGUI(Rect cellRect, AssetTreeItem item, int column, ref RowGUIArgs args) { if (item == null) { return; } Color oldColor = GUI.color; CenterRectUsingSingleLineHeight(ref cellRect); if (column != 3) { GUI.color = item.itemColor; } switch (column) { case 0: { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); DefaultGUI.Label( new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), item.displayName, args.selected, args.focused); } break; case 1: DefaultGUI.Label(cellRect, item.asset.bundleName, args.selected, args.focused); break; case 2: DefaultGUI.Label(cellRect, item.asset.GetSizeString(), args.selected, args.focused); break; case 3: //var icon = item.MessageIcon(); Texture2D icon = null; if (icon != null) { var iconRect = new Rect(cellRect.x, cellRect.y, cellRect.height, cellRect.height); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); } break; } GUI.color = oldColor; }
public void AddAssetsToNode(AssetTreeItem root) { if (root == null) { return; } foreach (var itr in m_ConcreteAssets) { root.AddChild(new AssetTreeItem(itr)); } foreach (var itr in m_DependentAssets) { if (!root.ContainsChild(itr)) { root.AddChild(new AssetTreeItem(itr)); } } }
public static AssetTreeItem CreateAssetListTreeView(List <BundleDataInfo> selectes) { var root = new AssetTreeItem(); root.children = new List <TreeViewItem>(); if (selectes != null) { foreach (var itr in selectes) { if (itr == null) { continue; } itr.AddAssetsToNode(root); } } return(root); }