示例#1
0
        /// <summary>
        /// Bundle的信息
        /// </summary>
        /// <param name="node"></param>
        /// <param name="allTree"></param>
        public AssetBundleInfo(AssetDependenctGraph.Node node, Dictionary <string, AssetDependenctGraph.Node> allTree, SortedList <string, AssetBundleInfo> __sortedBundleTree)
        {
            this.selfNode = node;

            Tree = allTree;

            sortedBundleTree = __sortedBundleTree;

            var info = new FileInfo(node.NodePath);

            //检测是否必须单独进行打包
            if (AssetPathRule.IsMustBuild(node.NodePath))
            {
                alone_set = true;
            }

            size = info.Length;

            lastWriteTime = info.LastWriteTime;

            //查询构建被引用了多少次
            BuildBeDependenctCount(this.selfNode);

            //this.guid = AssetDatabase.AssetPathToGUID(BuildUtils.GetAssetRelativePath(this.selfNode.NodePath));

            //guid = AssetDatabase.AssetPathToGUID(this.selftree.assetPath);
            //var extension = Path.GetExtension(this.selfNode.NodePath);

            //获取资源打包的类型数据
            type = AssetFileType.GetAssetBundleBuildType(this.selfNode.NodePath, Path.GetExtension(this.selfNode.NodePath));
        }
示例#2
0
        /// <summary>
        /// 查找自己被使用了几次.
        /// </summary>
        /// <param name="tempNode"></param>
        private void BuildAlreadyBuildCount(AssetDependenctGraph.Node tempNode)
        {
            for (int i = 0; i < tempNode.Parents.Count; i++)
            {
                AssetDependenctGraph.Node node;

                if (Tree.TryGetValue(tempNode.Parents[i], out node))
                {
                    AssetBundleInfo bundles;

                    var bundleKey = BuildUtils.GetPathDirWithoutExtension(tempNode.Parents[i]);

                    if (sortedBundleTree.TryGetValue(bundleKey, out bundles))
                    {
                        if (bundles.AlreadyBuild())// && Mathf.Abs(bundles.selfNode.Depth - this.selfNode.Depth) == 1)
                        {
                            alreadyBuildCount++;
                            continue;
                        }
                    }
                    if (node.Parents != null && node.Parents.Count > 0)
                    {
                        //继续上走
                        BuildAlreadyBuildCount(node);
                    }
                }
            }
        }
示例#3
0
        public AssetNodeGraph(Dictionary <string, AssetDependenctGraph.Node> roots, AssetDependenctGraph.Node current)
        {
            trees = roots;

            tree = current;

            rects = new Rect[tree.Parents.Count + tree.AllChildren.Length + 1];
        }
示例#4
0
        /// <summary>
        /// 查找自己被使用了几次.
        /// </summary>
        /// <param name="tempNode"></param>
        public void BuildBeDependenctCount(AssetDependenctGraph.Node tempNode)
        {
            for (int i = 0; i < tempNode.Parents.Count; i++)
            {
                AssetDependenctGraph.Node node;

                if (Tree.TryGetValue(tempNode.Parents[i], out node))
                {
                    if (node.Parents != null && node.Parents.Count > 0)
                    {
                        //继续上走
                        BuildBeDependenctCount(node);
                        bedependencyCount++;
                    }
                    else
                    {
                        bedependencyCount++;
                        //统计+1
                    }
                }
            }
        }