Example #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));
        }
            /// <summary>
            /// 检测当前文件是否为shader文件
            /// </summary>
            /// <returns></returns>
            public bool IsShader()
            {
                if (string.IsNullOrEmpty(NodePath))
                {
                    return(false);
                }

                string extension = BuildUtils.GetPathExtension(NodePath);

                if (AssetFileType.GetAssetBundleBuildType(NodePath, extension) == AssetBundleBuildType.Shader)
                {
                    return(true);
                }
                return(false);
            }