Exemple #1
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));
                    }
                }