private void OnDependenciesLoadDataMore(string resPath, List <AssetTreeModel.AssetInfo> resInfos, AssetTreeModel treeModel) { // 去代码定义文件去查找 if (resPath != "\"Assets/Simple UI/PNG\"") { return; } int preLen = resPath.Length - "PNG".Length - 2; string codePath = "Assets/Demo/UISpriteDefine.cs"; try { string text = File.ReadAllText(codePath); foreach (var assetInfo in resInfos) { string searchText = assetInfo.fileRelativePath.Substring(preLen); searchText = searchText.Remove(searchText.Length - 4); if (text.Contains(searchText)) { AssetTreeModel.AssetInfo info = treeModel.GenAssetInfo(codePath); info.isExtra = true; assetInfo.AddChild(info); } } } catch (Exception ex) { Debug.LogError(ex.Message); } }
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); } } }