refactor : 重构代码
This commit is contained in:
+24
-23
@@ -107,12 +107,12 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 自定义参数:解密服务接口的实例类
|
||||
/// </summary>
|
||||
public IDecryptionServices DecryptionServices { private set; get; }
|
||||
public IBundleDecryptionServices BundleDecryptionServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||
public IManifestRestoreServices ManifestRestoreServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:拷贝内置文件接口的实例类
|
||||
@@ -139,29 +139,30 @@ namespace YooAsset
|
||||
var operation = new DBFSLoadPackageManifestOperation(this, options.PackageVersion);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
|
||||
{
|
||||
return _unpackFileSystem.ClearCacheFilesAsync(manifest, options);
|
||||
return _unpackFileSystem.ClearCacheFilesAsync(options);
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
|
||||
{
|
||||
// 注意:业务层的解压器会依赖该方法
|
||||
options.ImportFilePath = GetBuildinFileLoadPath(bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(bundle, options);
|
||||
options.ImportFilePath = GetBuildinFileLoadPath(options.Bundle);
|
||||
return _unpackFileSystem.DownloadFileAsync(options);
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
|
||||
{
|
||||
PackageBundle bundle = options.Bundle;
|
||||
if (IsUnpackBundleFile(bundle))
|
||||
{
|
||||
return _unpackFileSystem.LoadBundleFile(bundle);
|
||||
return _unpackFileSystem.LoadBundleAsync(options);
|
||||
}
|
||||
|
||||
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
|
||||
if (bundle.BundleType == (int)EBundleType.AssetBundle)
|
||||
{
|
||||
var operation = new DBFSLoadAssetBundleOperation(this, bundle);
|
||||
return operation;
|
||||
}
|
||||
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
|
||||
else if (bundle.BundleType == (int)EBundleType.RawBundle)
|
||||
{
|
||||
var operation = new DBFSLoadRawBundleOperation(this, bundle);
|
||||
return operation;
|
||||
@@ -224,13 +225,13 @@ namespace YooAsset
|
||||
{
|
||||
UnpackFileSystemRoot = (string)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
|
||||
else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
|
||||
{
|
||||
DecryptionServices = (IDecryptionServices)value;
|
||||
BundleDecryptionServices = (IBundleDecryptionServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||
else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
|
||||
{
|
||||
ManifestServices = (IManifestRestoreServices)value;
|
||||
ManifestRestoreServices = (IManifestRestoreServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
||||
{
|
||||
@@ -264,7 +265,7 @@ namespace YooAsset
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_LEVEL, FileVerifyLevel);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_MAX_CONCURRENCY, FileVerifyMaxConcurrency);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, BundleDecryptionServices);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES, CopyLocalFileServices);
|
||||
_unpackFileSystem.OnCreate(packageName, UnpackFileSystemRoot);
|
||||
}
|
||||
@@ -409,7 +410,7 @@ namespace YooAsset
|
||||
if (bundle.Encrypted)
|
||||
return true;
|
||||
|
||||
if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
|
||||
if (bundle.BundleType == (int)EBundleType.RawBundle)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -479,31 +480,31 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 加载加密的资源文件
|
||||
/// </summary>
|
||||
public DecryptResult LoadEncryptedAssetBundle(PackageBundle bundle)
|
||||
public DecryptSyncResult LoadEncryptedBundleSync(PackageBundle bundle)
|
||||
{
|
||||
string filePath = GetBuildinFileLoadPath(bundle);
|
||||
var fileInfo = new DecryptFileInfo()
|
||||
var bundleInfo = new DecryptBundleInfo()
|
||||
{
|
||||
BundleName = bundle.BundleName,
|
||||
FileLoadCRC = bundle.UnityCRC,
|
||||
FileLoadPath = filePath,
|
||||
};
|
||||
return DecryptionServices.LoadAssetBundle(fileInfo);
|
||||
return BundleDecryptionServices.LoadAssetBundleSync(bundleInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载加密的资源文件
|
||||
/// </summary>
|
||||
public DecryptResult LoadEncryptedAssetBundleAsync(PackageBundle bundle)
|
||||
public DecryptAsyncResult LoadEncryptedBundleAsync(PackageBundle bundle)
|
||||
{
|
||||
string filePath = GetBuildinFileLoadPath(bundle);
|
||||
var fileInfo = new DecryptFileInfo()
|
||||
var bundleInfo = new DecryptBundleInfo()
|
||||
{
|
||||
BundleName = bundle.BundleName,
|
||||
FileLoadCRC = bundle.UnityCRC,
|
||||
FileLoadPath = filePath,
|
||||
};
|
||||
return DecryptionServices.LoadAssetBundleAsync(fileInfo);
|
||||
return BundleDecryptionServices.LoadAssetBundleAsync(bundleInfo);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user