示例#1
0
        private void Build()
        {
            PublishContent content = new PublishContent(this.mPlatform);

            content.version    = version;
            content.resVersion = resVersion;
            content.bigVersion = bigVersion;
            content.resUrl     = "http://热更新资源地址";
            new PublishCommand().Execute(content);
        }
        public override void Execute(object content)
        {
            base.Execute(content);

            PublishContent publishContent = _content as PublishContent;

            if (publishContent.referenceABSetting)
            {
                AssetBundleTool.BuildDepend();
            }

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

            PublishContent publishContent = _content as PublishContent;

            if (publishContent.bigVersion)
            {
                BuildPlayer(publishContent.GetVersionPath(), publishContent.platform);
            }

            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);
        }
示例#6
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);
        }
        public override void Execute(object content)
        {
            base.Execute(content);

            PublishContent publishContent = this._content as PublishContent;

            if (!publishContent.bigVersion)
            {
                string updateFilePath = publishContent.GetUpdateFilePath();
                string updateFile     = "/res_" + publishContent.resVersion + ".bin";
                string updateFullFile = publishContent.GetVersionPath() + updateFile;
                FileOperateUtil.CreateFileDirectory(updateFullFile);

                FolderEncoder folderEncoder = new FolderEncoder(updateFilePath, updateFullFile, "*.*");
                long          size          = folderEncoder.Encode(null);

                publishContent.updateFile     = updateFile;
                publishContent.updateFileSize = size;
            }

            this.Success(publishContent);
        }
示例#8
0
        private void ResetVersion()
        {
            string path = PublishContent.GetPlatformPath(PublishContent.DEFINE_PUBLISH_PATH, this.mPlatform);
            string file = path + "/version.xml";

            if (File.Exists(file))
            {
                string         text           = File.ReadAllText(file);
                VersionContent versionContent = new VersionContent();
                versionContent.Parse(text);

                string[] vStrList = versionContent.version.Split('.');
                if (bigVersion)
                {
                    version    = vStrList[0] + "." + (Convert.ToInt32(vStrList[1]) + 1);
                    resVersion = version + ".0";
                }
                else
                {
                    if (versionContent.resVersions.Count > 0)
                    {
                        resVersion = versionContent.resVersions[versionContent.resVersions.Count - 1].version;
                    }
                    else
                    {
                        resVersion = versionContent.version + ".0";
                    }
                    string[] resVStrList = resVersion.Split('.');
                    resVersion = resVStrList[0] + "." + resVStrList[1] + "." + (Convert.ToInt32(resVStrList[2]) + 1);
                    version    = versionContent.version;
                }
            }
            else
            {
                version    = "1.0";
                resVersion = "1.0.0";
            }
        }
        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);
        }