refactor : 重构代码

This commit is contained in:
何冠峰
2026-01-16 10:28:01 +08:00
parent 2b6e7856e7
commit b0e85017d2
100 changed files with 1042 additions and 1582 deletions
@@ -61,12 +61,12 @@ namespace YooAsset
/// <summary>
/// 自定义参数:解密服务接口的实例类
/// </summary>
public IWebDecryptionServices DecryptionServices { private set; get; }
public IWebBundleDecryptionServices BundleDecryptionServices { private set; get; }
/// <summary>
/// 自定义参数:资源清单服务类
/// </summary>
public IManifestRestoreServices ManifestServices { private set; get; }
public IManifestRestoreServices ManifestRestoreServices { private set; get; }
#endregion
@@ -88,18 +88,19 @@ namespace YooAsset
var operation = new DWRFSLoadPackageManifestOperation(this, options.PackageVersion, options.Timeout);
return operation;
}
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
PackageBundle bundle = options.Bundle;
if (bundle.BundleType == (int)EBundleType.AssetBundle)
{
var operation = new DWRFSLoadAssetBundleOperation(this, bundle);
return operation;
@@ -130,13 +131,13 @@ namespace YooAsset
{
RemoteServices = (IRemoteServices)value;
}
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
{
DecryptionServices = (IWebDecryptionServices)value;
BundleDecryptionServices = (IWebBundleDecryptionServices)value;
}
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
{
ManifestServices = (IManifestRestoreServices)value;
ManifestRestoreServices = (IManifestRestoreServices)value;
}
else
{
@@ -36,18 +36,18 @@ namespace YooAsset
{
string mainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
string fallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
options.SetURL(mainURL, fallbackURL);
if (_bundle.Encrypted)
{
_loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(_bundle, options, _fileSystem.DecryptionServices, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(options, _fileSystem.BundleDecryptionServices, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
else
{
_loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(_bundle, options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
@@ -65,7 +65,7 @@ namespace YooAsset
{
string packageHash = _requestWebPackageHashOp.PackageHash;
string packageName = _fileSystem.PackageName;
var manifestServices = _fileSystem.ManifestServices;
var manifestServices = _fileSystem.ManifestRestoreServices;
var remoteServices = _fileSystem.RemoteServices;
var downloadBackend = _fileSystem.DownloadBackend;
_loadWebPackageManifestOp = new LoadWebPackageManifestOperation(manifestServices, remoteServices, downloadBackend, packageName, _packageVersion, packageHash, _timeout);