From 7d21da76fbf9170820691ac76cc08fa759bc897a Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 20 Feb 2023 15:54:22 +0800 Subject: [PATCH] update sample --- .../GameScript/Editor/Encryption.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs index b69a63f..1b39c2f 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs @@ -42,7 +42,8 @@ public class FileStreamEncryption : IEncryptionServices { public EncryptResult Encrypt(EncryptFileInfo fileInfo) { - if (fileInfo.BundleName.Contains("gameres_music")) + // LoadFromStream + if (fileInfo.BundleName.Contains("_gameres_audio")) { var fileData = File.ReadAllBytes(fileInfo.FilePath); for (int i = 0; i < fileData.Length; i++) @@ -55,7 +56,22 @@ public class FileStreamEncryption : IEncryptionServices result.EncryptedData = fileData; return result; } - else + + // LoadFromFileOffset + if (fileInfo.BundleName.Contains("_gameres_uiimage")) + { + var fileData = File.ReadAllBytes(fileInfo.FilePath); + int offset = 32; + var temper = new byte[fileData.Length + offset]; + Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length); + + EncryptResult result = new EncryptResult(); + result.LoadMethod = EBundleLoadMethod.LoadFromFileOffset; + result.EncryptedData = temper; + return result; + } + + // Normal { EncryptResult result = new EncryptResult(); result.LoadMethod = EBundleLoadMethod.Normal;