通过解密接口判断是否需要走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) else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
EBundleLoadMethod loadMethod = (EBundleLoadMethod)MainBundleInfo.Bundle.LoadMethod; /// 判断是否需要解压文件
if (loadMethod == EBundleLoadMethod.LoadFromMemory || loadMethod == EBundleLoadMethod.LoadFromStream) if( Impl.DecryptionServices != null && Impl.DecryptionServices.UnpackBundleFile == false)
{
_steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath;
}
else
{ {
_steps = ESteps.LoadFile; _steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath; 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 #else
_steps = ESteps.LoadFile; _steps = ESteps.LoadFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath; FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;

View File

@ -43,8 +43,17 @@ namespace YooAsset
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming) else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromStreaming)
{ {
#if UNITY_ANDROID || UNITY_WEBGL #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 #else
_steps = ESteps.CheckFile; _steps = ESteps.CheckFile;
FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath; FileLoadPath = MainBundleInfo.Bundle.StreamingFilePath;

View File

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