Пример #1
0
        public virtual string[] GetRelatedFileList()
        {
            if (null == unrefResList || 0 == unrefResList.Count)
            {
                return(ResPackHelper.GetDependencies(mPath));
            }
            else
            {
                List <string> tmpList = new List <string>();
                string[]      files   = ResPackHelper.GetDependencies(mPath);
                string        path;
                for (int i = 0; i < files.Length; i++)
                {
                    path = files[i].Remove(0, 7);
                    if (path.EndsWith(".meta"))
                    {
                        path = path.Substring(0, path.Length - 5);
                    }

                    if (!unrefResList.Contains(path))
                    {
                        tmpList.Add(files[i]);
                    }
                }

                return(tmpList.ToArray());
            }
        }
Пример #2
0
        /// 打包AssetBundle资源,
        void BuildBundleResource(BundlePackInfo packInfo, string ifsBuildDir, BuildTarget target)
        {
            if (packInfo == null)
            {
                return;
            }
            // 本次打包的路径和目录
            string buildBundlePath      = JW.Res.FileUtil.CombinePaths(ifsBuildDir, "", packInfo.Path);
            string buildBundleDirectory = JW.Res.FileUtil.GetFullDirectory(buildBundlePath);

            if (!JW.Res.FileUtil.IsDirectoryExist(buildBundleDirectory))
            {
                JW.Res.FileUtil.CreateDirectory(buildBundleDirectory);
            }
            //========== build ==========
            List <string> filePathList = new List <string>();
            List <string> nameList     = new List <string>();

            for (int j = 0; j < packInfo.Resources.Count; j++)
            {
                ResInfo res = packInfo.Resources[j];
                filePathList.Add(res.RelativePath);
                nameList.Add(res.Path);
            }

            bool succ = false;

            //场景文件
            if (packInfo.HasFlag(EBundleFlag.UnityScene))
            {
                succ = ResPackHelper.BuildScene(filePathList, buildBundlePath);
            }
            else
            {
                //全局模式只是纯粹设置bundle 名称
                if (_packConfig.IsGlobalBuild)
                {
                    succ = ResPackHelper.JustSetBundleName(packInfo.Path, filePathList);
                }
                else
                {
                    EPackHandlerParam packHandlerParam = GeneratePackParam(packInfo);
                    succ = ResPackHelper.Build(buildBundlePath, filePathList, packHandlerParam, true, nameList);
                }
            }
            if (succ)
            {
                if (_packConfig.IsGlobalBuild)
                {
                    JW.Common.Log.LogD("Set BundleName Success " + buildBundlePath);
                }
                else
                {
                    JW.Common.Log.LogD("Build Bundle Success Out" + buildBundlePath);
                }
            }
            else
            {
                if (_packConfig.IsGlobalBuild)
                {
                    Terminate("Set bundleName failed, path:" + buildBundlePath);
                }
                else
                {
                    Terminate("Build bundle failed, path:" + buildBundlePath);
                }
            }
        }
 public string[] GetRelatedFileList()
 {
     return(ResPackHelper.GetDependencies(_path));
 }