通过解密接口判断是否需要走Unpack文件

pull/71/head
jiangyu 2023-02-27 11:53:17 +08:00
parent 0232e5adec
commit f4b7ae21ea
3 changed files with 33 additions and 9 deletions

View File

@ -51,17 +51,26 @@ namespace YooAsset
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{
#if UNITY_ANDROID
EBundleLoadMethod loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod;
if (loadMethod == EBundleLoadMethod.LoadFromMemory || loadMethod == EBundleLoadMethod.LoadFromStream)
{
_steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
}
else
/// 判断是否需要解压文件
if( Impl.DecryptionServices != null && Impl.DecryptionServices.UnpackBundleFile == false)
{
_steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;
}
else
{
EBundleLoadMethod loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod;
if (loadMethod == EBundleLoadMethod.LoadFromMemory || loadMethod == EBundleLoadMethod.LoadFromStream)
{
_steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
}
else
{
_steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;
}
}
#else
_steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;

View File

@ -43,8 +43,17 @@ namespace YooAsset
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{
#if UNITY_ANDROID || UNITY_WEBGL
_steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
/// 判断是否需要解压文件
if (Impl.DecryptionServices != null && Impl.DecryptionServices.UnpackBundleFile == false)
{
_steps = ESteps.CheckFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;
}
else
{
_steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
}
#else
_steps = ESteps.CheckFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;

View File

@ -19,6 +19,12 @@ namespace YooAsset
/// </summary>
public interface IDecryptionServices
{
/// <summary>
/// 是否需要解压文件
/// </summary>
bool UnpackBundleFile { get; }
/// <summary>
/// 文件偏移解密方法
/// </summary>