protected virtual bool OnWatcherImportedAssetsEvent(string[] importedAssets, bool resortItem) { if (importedAssets.Length == 0 || !resortItem || rootItem == null) { return(false); } Array.Sort(importedAssets, EditorUtility.NaturalCompare); foreach (var importedAsset in importedAssets) { var item = FindItemByAssetPath(rootItem, Path.GetDirectoryName(importedAsset)); if (item == null) { continue; } var assetInfo = GetItemAssetInfo(item); if (assetInfo == null) { continue; } // 查找是否原先已经有了(被删除再导入) var item2 = FindItemByAssetPath(item, importedAsset); if (item2 != null) { var assetInfo2 = GetItemAssetInfo(item2); if (assetInfo2 != null) { assetInfo2.deleted = false; assetInfo2.added = true; } } else { var assetInfo2 = m_Model.GenAssetInfo(importedAsset); assetInfo.AddChild(assetInfo2); item2 = new AssetTreeViewItem <AssetTreeModel.AssetInfo>(assetInfo2.id, -1, assetInfo2.displayName, assetInfo2); if (assetInfo2.isFolder) { item2.icon = AssetDanshariStyle.Get().folderIcon; } assetInfo2.added = true; item.AddChild(item2); } } SetupDepthsFromParentsAndChildren(rootItem); SortTreeViewNaturalCompare(rootItem); return(true); }
protected virtual void BuildDataDir(int depth, AssetModel.AssetInfo dirInfo, TreeViewItem parent) { var dirItem = new AssetTreeViewItem <AssetModel.AssetInfo>(dirInfo.id, depth, dirInfo.displayName, dirInfo); parent.AddChild(dirItem); if (dirInfo.hasChildren) { foreach (var childInfo in dirInfo.children) { BuildDataDir(depth + 1, childInfo, dirItem); } } }
protected override void CellGUI(Rect cellRect, AssetTreeViewItem <AssetModel.AssetInfo> item, int column, ref RowGUIArgs args) { var info = item.data; switch (column) { case 0: DrawItemWithIcon(cellRect, item, ref args, info.displayName, info.fileRelativePath, true, false, info.deleted); break; case 1: DefaultGUI.Label(cellRect, info.fileRelativePath, args.selected, args.focused); break; } }
private void BuildDataDir(AssetTreeModel.AssetInfo dirInfo, TreeViewItem parent) { var dirItem = new AssetTreeViewItem <AssetTreeModel.AssetInfo>(dirInfo.id, -1, dirInfo.displayName, dirInfo); if (dirInfo.isFolder) { dirItem.icon = AssetDanshariStyle.Get().folderIcon; } parent.AddChild(dirItem); if (dirInfo.hasChildren) { foreach (var childInfo in dirInfo.children) { BuildDataDir(childInfo, dirItem); } } }
protected virtual void CellGUI(Rect cellRect, AssetTreeViewItem <AssetTreeModel.AssetInfo> item, int column, ref RowGUIArgs args) { }