public override void Execute(object content)
        {
            base.Execute(content);

            PublishContent publishContent = content as PublishContent;

            if (!publishContent.bigVersion)
            {
                ProgressBarUtil.Title   = "AssetBundle文件拷贝";
                ProgressBarUtil.Content = "AssetBundle文件拷贝到缓存目录";
                ProgressBarUtil.Percent = 0.0f;
                ProgressBarUtil.Show();

                string resPath       = PublishContent.GetResPath(publishContent.GetRootPath());
                string resCachePath  = resPath + "Cache";
                string updateResPath = PublishContent.GetResPath(publishContent.GetUpdateFilePath());
                PublishUtil.Copy(updateResPath, resCachePath, "*.ab", new ABProgress());

                string versionResCachePath = PublishContent.GetResPath(publishContent.GetVersionPath());
                PublishUtil.Copy(resCachePath, versionResCachePath, "*.ab", new ABProgress());

                ProgressBarUtil.Title   = "Lua文件拷贝";
                ProgressBarUtil.Content = "Lua文件拷贝到缓存目录";
                ProgressBarUtil.Percent = 0.0f;
                string luaPath       = PublishContent.GetLuaPath(publishContent.GetRootPath());
                string luaCachePath  = luaPath + "Cache";
                string updateLuaPath = PublishContent.GetLuaPath(publishContent.GetUpdateFilePath());
                PublishUtil.Copy(updateLuaPath, luaCachePath, "*.lua", new ABProgress());

                string versionLuaCachePath = PublishContent.GetLuaPath(publishContent.GetVersionPath());
                PublishUtil.Copy(luaCachePath, versionLuaCachePath, "*.lua", new ABProgress());

                ProgressBarUtil.Close();
            }

            Success(publishContent);
        }
        public override void Execute(object content)
        {
            base.Execute(content);

            publishContent = _content as PublishContent;
            string resPath        = PublishContent.GetResPath(publishContent.GetRootPath());
            string resABPath      = PublishContent.GetABPath(resPath);
            string resCachePath   = resPath + "Cache";
            string resCacheABPath = PublishContent.GetABPath(resCachePath);

            FileOperateUtil.CreateDirectory(resCachePath);

            if (!publishContent.bigVersion)
            {
                ProgressBarUtil.Title   = "AssetBundle文件拷贝和对比";
                ProgressBarUtil.Content = "AssetBundle文件拷贝和对比";
                ProgressBarUtil.Percent = 0.0f;
                ProgressBarUtil.Show();

                string updatePath = PublishContent.GetResPath(this.publishContent.GetUpdateFilePath());
                PublishUtil.Compare(resPath, resCachePath, updatePath, "*.ab", false, new ABProgress());

                ProgressBarUtil.Close();
            }
            else
            {
                ProgressBarUtil.Title   = "AssetBundle文件拷贝";
                ProgressBarUtil.Content = "拷贝AssetBundle到缓存目录";
                ProgressBarUtil.Percent = 0.0f;
                ProgressBarUtil.Show();

                string projectABPath = PublishContent.GetABPath(Application.streamingAssetsPath);
                FileOperateUtil.ClearDirectory(projectABPath);
                FileOperateUtil.ClearDirectory(resCacheABPath);

                PublishUtil.Copy(resABPath, resCacheABPath, "*.ab", new ABProgress());

                ProgressBarUtil.Content = "拷贝AssetBundle到项目目录";
                PublishUtil.Copy(resCacheABPath, projectABPath, "*.ab", new ABProgress());

                ProgressBarUtil.Close();
            }
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            Success(publishContent);
        }
        public override void Execute(object content)
        {
            base.Execute(content);

            PublishContent publishContent = _content as PublishContent;

            string versionFile      = publishContent.GetVersionPath() + "/version.xml";
            string cacheVersionFile = publishContent.GetRootPath() + "/version.xml";

            FileOperateUtil.CreateFileDirectory(versionFile);

            if (publishContent.bigVersion)
            {
                VersionContent versionContent = new VersionContent();
                versionContent.version = publishContent.version;
                versionContent.resUrl  = publishContent.resUrl;
                versionContent.Save(versionFile);

                string projectVersionFile = FileOperateUtil.GetRegPath(Application.dataPath + "/Resources/version.bytes");
                File.Copy(versionFile, projectVersionFile, true);
            }
            else
            {
                VersionContent versionContent = new VersionContent();
                if (File.Exists(cacheVersionFile))
                {
                    versionContent.Parse(File.ReadAllText(cacheVersionFile));
                }
                versionContent.version = publishContent.version;
                versionContent.resUrl  = publishContent.resUrl;

                ResVersion resVersion;
                resVersion.version = publishContent.resVersion;
                resVersion.url     = publishContent.updateFile;
                resVersion.md5     = publishContent.updateFileMD5;
                resVersion.size    = publishContent.updateFileSize;

                versionContent.resVersions.Add(resVersion);
                versionContent.Save(versionFile);
            }

            File.Copy(versionFile, cacheVersionFile, true);

            Success(publishContent);
        }
Exemplo n.º 4
0
        public override void Execute(object content)
        {
            base.Execute(content);

            publishContent = _content as PublishContent;
            string resPath   = PublishContent.GetResPath(publishContent.GetRootPath());
            string resABPath = PublishContent.GetABPath(resPath);

            //            bool clearResPath = this.publishContent.env == PublishEnvironment.ONLINE;
            bool clearResPath = publishContent.bigVersion;  //不清理res资源

            FileOperateUtil.CreateDirectory(resPath, clearResPath);

            BuildTarget target = publishContent.GetBuildTarget();

            AssetBundleTool.Build(resABPath, target);

            Success(publishContent);
        }