Exemple #1
0
        public void AddAsset(string guid, HashSet <string> incluedPathes)
        {
            if (string.IsNullOrEmpty(guid))
            {
                return;
            }

            TreeNode <AssetData> node = _root;

            string assetPath = AssetDatabase.GUIDToAssetPath(guid);

            if (assetPath.StartsWith("Packages"))
            {
                return;
            }

            int startIndex = 0, length = assetPath.Length;

            var isSelected = incluedPathes.Contains(assetPath);

            var isExpanded = incluedPathes.Any(path => path.Contains(assetPath));

            while (startIndex < length)
            {
                int    endIndex  = assetPath.IndexOf('/', startIndex);
                int    subLength = endIndex == -1 ? length - startIndex : endIndex - startIndex;
                string directory = assetPath.Substring(startIndex, subLength);

                var pathNode = new AssetData(endIndex == -1 ? guid : null, directory,
                                             assetPath.Substring(0, endIndex == -1 ? length : endIndex), node.Level == 0 || isExpanded,
                                             isSelected);

                var child = node.FindInChildren(pathNode);

                if (child == null)
                {
                    child = node.AddChild(pathNode);
                }

                node        = child;
                startIndex += subLength + 1;
            }
        }
Exemple #2
0
 public bool Equals(AssetData node)
 {
     return(node.path == path);
 }
Exemple #3
0
        public override bool Equals(object obj)
        {
            AssetData node = obj as AssetData;

            return(node != null && node.path == path);
        }