public ABInspectorOrganizationTreeView(TreeViewState state, MultiColumnHeaderState headerState) : base(state, new MultiColumnHeader(headerState)) { root = new OrganizationTreeViewItem(-1, -1, ""); root.children = new List <TreeViewItem>(); showBorder = true; }
private void CreatTreeView(OrganizationTreeViewItem parent, ABInspectorItemData node, int depth) { string path = AssetDatabase.GUIDToAssetPath(node.GUID); string name = Path.GetFileName(path); OrganizationTreeViewItem nodeItem = new OrganizationTreeViewItem(node.GUID.GetHashCode(), depth, name); nodeItem.children = new List <TreeViewItem>(); //只显示类型名,忽略其他信息 string TypeName = AssetDatabase.GetMainAssetTypeAtPath(path).ToString(); nodeItem.Type = TypeName.Substring(TypeName.LastIndexOf(".") + 1); nodeItem.Count = node.Dependency.Count; nodeItem.icon = AssetDatabase.GetCachedIcon(path) as Texture2D; parent.AddChild(nodeItem); foreach (var dpcGUID in node.Dependency) { ABInspectorItemData dpcNode = GetABInspectorItemDataByGUID(dpcGUID); CreatTreeView(nodeItem, dpcNode, depth + 1); } }