Ejemplo n.º 1
0
 public void AddChild(DependenceNode node)
 {
     node.parent = this;
     node.ChangeLayer(layer + 1);
     editorOpen         = true;
     node.deleteHandler = DeleteChild;
     childList.Add(node);
     node.ChangeIndex(childList.IndexOf(node));
 }
Ejemplo n.º 2
0
 public void AddTree(DependenceNode tree)
 {
     if (m_treeList.Contains(tree))
     {
         return;
     }
     tree.ChangeLayer(0);
     tree.deleteHandler = DeleteTree;
     m_treeList.Add(tree);
     tree.ChangeIndex(m_treeList.IndexOf(tree));
 }
Ejemplo n.º 3
0
            public bool HasSameNodeName(DependenceNode node, string nodeName)
            {
                bool has = false;

                foreach (var tree in m_treeList)
                {
                    if (tree.HasSameName(node, nodeName))
                    {
                        has = true;
                        break;
                    }
                }
                return(has);
            }
Ejemplo n.º 4
0
                public bool HasNode(DependenceNode node)
                {
                    bool has = false;

                    for (int i = 0; i < childList.Count; i++)
                    {
                        if (childList[i] == node)
                        {
                            has = true;
                        }
                        else
                        {
                            has = childList[i].HasNode(node);
                        }
                    }
                    return(has);
                }
Ejemplo n.º 5
0
                public DependenceNode(BundleGroup group, DependenceNode parent, string bundleName, bool editorOpen, int layer, int index, BundleType bundleType, Action <DependenceNode> onDeleteOwn)
                {
                    this.group         = group;
                    this.bundleName    = bundleName;
                    this.oldBundleName = bundleName;
                    this.editorOpen    = editorOpen;
                    this.bundleType    = bundleType;
                    this.layer         = layer;
                    this.index         = index;
                    this.parent        = parent;
                    renaming           = true;
                    childList          = new List <DependenceNode>();
                    includeList        = new List <AssetData>();
                    referenceList      = new List <AssetData>();

                    deleteHandler = onDeleteOwn;
                }
Ejemplo n.º 6
0
                public bool HasSameName(DependenceNode node, string nodeName)
                {
                    if (string.Equals(bundleName, nodeName) && node != this)
                    {
                        return(true);
                    }
                    bool has = false;

                    foreach (var child in childList)
                    {
                        if (string.Equals(child.bundleName, nodeName) && child != node)
                        {
                            has = true;
                            break;
                        }
                        has = child.HasSameName(node, nodeName);
                        if (has)
                        {
                            break;
                        }
                    }
                    return(has);
                }
Ejemplo n.º 7
0
 public void DeleteTree(DependenceNode tree)
 {
     m_treeList.Remove(tree);
 }
Ejemplo n.º 8
0
 private void DeleteChild(DependenceNode node)
 {
     childList.Remove(node);
 }
Ejemplo n.º 9
0
                public DependenceNode(IDictionary <string, IJsonNode> json, BundleGroup group, DependenceNode parent, Action <DependenceNode> onDeleteOwn)
                {
                    this.parent   = parent;
                    deleteHandler = onDeleteOwn;
                    this.group    = group;
                    childList     = new List <DependenceNode>();
                    includeList   = new List <AssetData>();
                    referenceList = new List <AssetData>();
                    bundleName    = json["bundleName"].AsString();
                    priority      = json["priority"].AsInt();
                    if (json["mainAsset"].type == EJsonType.Object)
                    {
                        mainAsset = new AssetData(json["mainAsset"].AsDict());
                        if (!mainAsset.CheckHas())
                        {
                            mainAsset = null;
                        }
                    }
                    bundleType = (BundleType)json["bundleType"].AsInt();
                    editorOpen = Convert.ToBoolean(json["editorOpen"].AsString());
                    layer      = json["layer"].AsInt();
                    index      = json["index"].AsInt();
                    version    = json["version"].AsInt();
                    //size = (long)json["size"].AsDouble();

                    var includeJson = json["includeList"].AsList();

                    for (int i = 0; i < includeJson.Count; i++)
                    {
                        var data = new AssetData(includeJson[i].AsDict());
                        if (!File.Exists(GetRealPath(data.path)))
                        {
                            continue;
                        }
                        includeList.Add(data);
                        size += GetFileSize(data.path);
                    }

                    var referenceJson = json["referenceList"].AsList();

                    for (int i = 0; i < referenceJson.Count; i++)
                    {
                        var data = new AssetData(referenceJson[i].AsDict());
                        if (!File.Exists(GetRealPath(data.path)))
                        {
                            continue;
                        }
                        referenceList.Add(data);
                    }
                    var childJson = json["childList"].AsList();

                    for (int i = 0; i < childJson.Count; i++)
                    {
                        childList.Add(new DependenceNode(childJson[i].AsDict(), group, this, DeleteChild));
                    }
                }