diff --git a/Docs/AssetBundleBuilder.md b/Docs/AssetBundleBuilder.md index b13ab8f..868bcac 100644 --- a/Docs/AssetBundleBuilder.md +++ b/Docs/AssetBundleBuilder.md @@ -28,9 +28,13 @@ (4) 模拟构建模式:在编辑器下配合EditorSimulateMode运行模式,来模拟真实运行的环境。 +- **Build Version** + + 构建的资源包版本。 + - **Build Package** - 需要构建的资源包名称。 + 构建的资源包名称。 - **Encryption** @@ -70,38 +74,6 @@ 点击构建按钮会开始构建流程,构建流程分为多个节点顺序执行,如果某个节点发生错误,会导致构建失败。错误信息可以在控制台查看。 -### 资源包加密 - -编写继承IEncryptionServices接口的加密类。注意:加密类文件需要放置在Editor文件夹里。 - -````C# -using System; -using YooAsset.Editor; - -public class GameEncryption : IEncryptionServices -{ - /// - /// 检测资源包是否需要加密 - /// - bool IEncryptionServices.Check(string bundleName) - { - // 对配置表相关的资源包进行加密 - return bundleName.Contains("assets/config/"); - } - - /// - /// 对数据进行加密,并返回加密后的数据 - /// - byte[] IEncryptionServices.Encrypt(byte[] fileData) - { - int offset = 32; - var temper = new byte[fileData.Length + offset]; - Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length); - return temper; - } -} -```` - ### 补丁包 构建成功后会在输出目录下找到补丁包文件夹,该文件夹名称为本次构建时指定的资源版本号。 @@ -141,7 +113,6 @@ private static void BuildInternal(BuildTarget buildTarget) buildParameters.PackageName = "DefaultPackage"; buildParameters.PackageVersion = "1.0.0"; buildParameters.VerifyBuildingResult = true; - buildParameters.EncryptionServices = new GameEncryption(); buildParameters.CompressOption = ECompressOption.LZ4; buildParameters.OutputNameStyle = EOutputNameStyle.HashName_Extension; buildParameters.CopyBuildinFileOption = ECopyBuildinFileOption.None; diff --git a/Docs/CodeTutorial2.md b/Docs/CodeTutorial2.md index 0e8b23c..0233d2b 100644 --- a/Docs/CodeTutorial2.md +++ b/Docs/CodeTutorial2.md @@ -126,24 +126,15 @@ private IEnumerator TryUpdateStaticVersion() { // 如果获取远端资源版本成功,说明当前网络连接并无问题,可以走正常更新流程。 ...... - - // 注意:在成功下载所有资源之后,我们需要记录当前最新的资源版本号 - PlayerPrefs.SetString("STATIC_VERSION", packageCRC); } } -private IEnumerator TryUpdateStaticVersion() +private IEnumerator WeaklyUpdate() { // 如果获取远端资源版本失败,我们走弱联网更新模式。 - // 注意:如果从来没有保存过版本信息,则需要从内部读取StaticVersion.bytes文件的版本信息。 - string packageVersion = PlayerPrefs.GetString("STATIC_VERSION", string.Empty); - if (packageVersion == string.Empty) - { - packageVersion = LoadStaticVersionFromStreamingAssets(); - } - - // 在弱联网情况下更新补丁清单 - var operation = package.WeaklyUpdateManifestAsync(packageVersion); + // 弱联网更新方法,会优先加载沙盒内的清单,如果不存在再加载内置清单。 + // 在加载清单之后,验证清单内资源内容本地完整性。 + var operation = package.WeaklyUpdateManifestAsync(); yield return operation; if (operation.Status == EOperationStatus.Succeed) { @@ -151,7 +142,7 @@ private IEnumerator TryUpdateStaticVersion() } else { - // 指定版本的资源内容本地并不完整,需要提示玩家更新。 + // 资源内容本地并不完整,需要提示玩家联网更新。 ShowMessageBox("请检查本地网络,有新的游戏内容需要更新!"); } } diff --git a/Docs/Image/AssetBuilder-img1.png b/Docs/Image/AssetBuilder-img1.png index 3ccc7e1..a40d9f2 100644 Binary files a/Docs/Image/AssetBuilder-img1.png and b/Docs/Image/AssetBuilder-img1.png differ diff --git a/Docs/Image/AssetBuilder-img2.png b/Docs/Image/AssetBuilder-img2.png index 0cffdc8..3309a8b 100644 Binary files a/Docs/Image/AssetBuilder-img2.png and b/Docs/Image/AssetBuilder-img2.png differ diff --git a/Docs/Image/AssetReporter-img1.png b/Docs/Image/AssetReporter-img1.png index b99ab3a..9081e2b 100644 Binary files a/Docs/Image/AssetReporter-img1.png and b/Docs/Image/AssetReporter-img1.png differ diff --git a/Docs/Image/AssetReporter-img2.png b/Docs/Image/AssetReporter-img2.png index 500cef5..32f35d0 100644 Binary files a/Docs/Image/AssetReporter-img2.png and b/Docs/Image/AssetReporter-img2.png differ diff --git a/Docs/Image/AssetReporter-img3.png b/Docs/Image/AssetReporter-img3.png index 26bfbdc..9e226f0 100644 Binary files a/Docs/Image/AssetReporter-img3.png and b/Docs/Image/AssetReporter-img3.png differ diff --git a/Docs/Image/ShaderVariantCollector-img1.png b/Docs/Image/ShaderVariantCollector-img1.png index df43c90..3fdfe1c 100644 Binary files a/Docs/Image/ShaderVariantCollector-img1.png and b/Docs/Image/ShaderVariantCollector-img1.png differ