/// <summary>
        /// 加载补丁清单文件
        /// </summary>
        internal static PatchManifest LoadPatchManifestFile(string fileDirectory, int resourceVersion)
        {
            string filePath = $"{fileDirectory}/{YooAssetSettingsData.GetPatchManifestFileName(resourceVersion)}";

            if (File.Exists(filePath) == false)
            {
                throw new System.Exception($"Not found patch manifest file : {filePath}");
            }

            string jsonData = FileUtility.ReadFile(filePath);

            return(PatchManifest.Deserialize(jsonData));
        }
Example #2
0
        /// <summary>
        /// 从输出目录加载补丁清单文件
        /// </summary>
        public static PatchManifest LoadPatchManifestFile(string fileDirectory)
        {
            string filePath = $"{fileDirectory}/{PatchDefine.PatchManifestFileName}";

            if (File.Exists(filePath) == false)
            {
                throw new System.Exception($"Not found patch manifest file : {filePath}");
            }

            string jsonData = FileUtility.ReadFile(filePath);

            return(PatchManifest.Deserialize(jsonData));
        }
        /// <summary>
        /// 从输出目录加载补丁清单文件
        /// </summary>
        private PatchManifest LoadPatchManifestFile()
        {
            string filePath = $"{OutputDirectory}/{PatchDefine.PatchManifestFileName}";

            if (File.Exists(filePath) == false)
            {
                return(new PatchManifest());
            }

            string jsonData = FileUtility.ReadFile(filePath);

            return(PatchManifest.Deserialize(jsonData));
        }
        /// <summary>
        /// 从输出目录加载补丁清单文件
        /// </summary>
        public static PatchManifest LoadPatchManifestFile(BuildParametersContext buildParameters)
        {
            string filePath = $"{buildParameters.OutputDirectory}/{PatchDefine.PatchManifestFileName}";

            if (File.Exists(filePath) == false)
            {
                return(new PatchManifest());
            }

            string jsonData = FileUtility.ReadFile(filePath);

            return(PatchManifest.Deserialize(jsonData));
        }
Example #5
0
        /// <summary>
        /// 复制所有补丁包文件到流目录
        /// </summary>
        /// <param name="targetVersion">目标版本。如果版本为负值则拷贝所有版本</param>
        public static void CopyPackageToStreamingFolder(BuildTarget buildTarget, string outputRoot, int targetVersion = -1)
        {
            // 补丁清单路径
            string filePath = $"{outputRoot}/{buildTarget}/{PatchDefine.UnityManifestFileName}/{PatchDefine.PatchManifestFileName}";

            if (File.Exists(filePath) == false)
            {
                throw new System.Exception($"Not found {PatchDefine.PatchManifestFileName} file : {filePath}");
            }

            // 加载补丁清单
            string        jsonData = FileUtility.ReadFile(filePath);
            PatchManifest pm       = PatchManifest.Deserialize(jsonData);

            // 拷贝文件列表
            foreach (var element in pm.ElementList)
            {
                if (element.IsDLC())
                {
                    continue;
                }

                if (targetVersion >= 0 && element.Version > targetVersion)
                {
                    continue;
                }

                string sourcePath = $"{outputRoot}/{buildTarget}/{element.Version}/{element.Name}";
                string destPath   = $"{Application.dataPath}/StreamingAssets/{element.Name}";
                Debug.Log($"拷贝版本文件到流目录:{destPath}");
                EditorTools.CopyFile(sourcePath, destPath, true);
            }

            // 拷贝核心文件
            {
                string destFilePath = $"{Application.dataPath}/StreamingAssets/{PatchDefine.PatchManifestFileName}";
                EditorTools.CopyFile(filePath, destFilePath, true);
            }

            // 刷新目录
            AssetDatabase.Refresh();
        }