mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-28 03:28:47 +00:00
Compare commits
1 Commits
c1acc6fe70
...
3ddfed4bf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ddfed4bf1 |
@@ -93,11 +93,6 @@ namespace YooAsset
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:拷贝内置文件服务类
|
||||
/// </summary>
|
||||
public ICopyBuildinBundleServices CopyBuildinBundleServices { private set; get; }
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -188,10 +183,6 @@ namespace YooAsset
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES)
|
||||
{
|
||||
CopyBuildinBundleServices = (ICopyBuildinBundleServices)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
YooLogger.Warning($"Invalid parameter : {name}");
|
||||
@@ -214,7 +205,6 @@ namespace YooAsset
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.INSTALL_CLEAR_MODE, InstallClearMode);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES, CopyBuildinBundleServices);
|
||||
_unpackFileSystem.OnCreate(packageName, null);
|
||||
}
|
||||
public virtual void OnDestroy()
|
||||
|
||||
@@ -104,11 +104,6 @@ namespace YooAsset
|
||||
/// 自定义参数:资源清单服务类
|
||||
/// </summary>
|
||||
public IManifestServices ManifestServices { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数:拷贝内置文件服务类
|
||||
/// </summary>
|
||||
public ICopyBuildinBundleServices CopyBuildinBundleServices { private set; get; }
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -235,10 +230,6 @@ namespace YooAsset
|
||||
{
|
||||
ManifestServices = (IManifestServices)value;
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_BUILDIN_BUNDLE_SERVICES)
|
||||
{
|
||||
CopyBuildinBundleServices = (ICopyBuildinBundleServices)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
YooLogger.Warning($"Invalid parameter : {name}");
|
||||
|
||||
@@ -37,10 +37,7 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isReuqestLocalFile && _fileSystem.CopyBuildinBundleServices != null)
|
||||
_steps = ESteps.CopyBuildinBundle;
|
||||
else
|
||||
_steps = ESteps.CreateRequest;
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,42 +84,6 @@ namespace YooAsset
|
||||
DisposeWebRequest();
|
||||
}
|
||||
|
||||
// 拷贝内置文件
|
||||
if (_steps == ESteps.CopyBuildinBundle)
|
||||
{
|
||||
FileUtility.CreateFileDirectory(_tempFilePath);
|
||||
|
||||
// 删除临时文件
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
|
||||
try
|
||||
{
|
||||
//TODO 团结引擎,在某些机型(红米),拷贝包内文件会小概率失败!需要借助其它方式来拷贝包内文件。
|
||||
_fileSystem.CopyBuildinBundleServices.CopyBuildinFile(_requestURL, _tempFilePath);
|
||||
if (File.Exists(_tempFilePath))
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = Bundle.FileSize;
|
||||
Progress = DownloadProgress;
|
||||
_steps = ESteps.VerifyTempFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = $"Failed copy buildin bundle : {_requestURL}";
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Error = $"Failed copy buildin bundle : {ex.Message}";
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
}
|
||||
|
||||
// 验证下载文件
|
||||
if (_steps == ESteps.VerifyTempFile)
|
||||
{
|
||||
|
||||
@@ -40,10 +40,7 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isReuqestLocalFile && _fileSystem.CopyBuildinBundleServices != null)
|
||||
_steps = ESteps.CopyBuildinBundle;
|
||||
else
|
||||
_steps = ESteps.CreateRequest;
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,42 +104,6 @@ namespace YooAsset
|
||||
DisposeWebRequest();
|
||||
}
|
||||
|
||||
// 拷贝内置文件
|
||||
if (_steps == ESteps.CopyBuildinBundle)
|
||||
{
|
||||
FileUtility.CreateFileDirectory(_tempFilePath);
|
||||
|
||||
// 删除临时文件(不支持断点续传)
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
|
||||
try
|
||||
{
|
||||
//TODO 团结引擎,在某些机型(红米),拷贝包内文件会小概率失败!需要借助其它方式来拷贝包内文件。
|
||||
_fileSystem.CopyBuildinBundleServices.CopyBuildinFile(_requestURL, _tempFilePath);
|
||||
if (File.Exists(_tempFilePath))
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = Bundle.FileSize;
|
||||
Progress = DownloadProgress;
|
||||
_steps = ESteps.VerifyTempFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = $"Failed copy buildin bundle : {_requestURL}";
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Error = $"Failed copy buildin bundle : {ex.Message}";
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
}
|
||||
|
||||
// 验证下载文件
|
||||
if (_steps == ESteps.VerifyTempFile)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,5 @@ namespace YooAsset
|
||||
public const string ASYNC_SIMULATE_MAX_FRAME = "ASYNC_SIMULATE_MAX_FRAME";
|
||||
public const string COPY_BUILDIN_PACKAGE_MANIFEST = "COPY_BUILDIN_PACKAGE_MANIFEST";
|
||||
public const string COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT = "COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT";
|
||||
public const string COPY_BUILDIN_BUNDLE_SERVICES = "COPY_BUILDIN_BUNDLE_SERVICES";
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 拷贝内置文件服务类
|
||||
/// </summary>
|
||||
public interface ICopyBuildinBundleServices
|
||||
{
|
||||
void CopyBuildinFile(string buildinFileURL, string destFilePath);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2eb3bd510fd41c48a01dcc26dd9b985
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,7 +11,6 @@ namespace YooAsset
|
||||
CheckExists,
|
||||
CreateRequest,
|
||||
CheckRequest,
|
||||
CopyBuildinBundle,
|
||||
VerifyTempFile,
|
||||
CheckVerifyTempFile,
|
||||
TryAgain,
|
||||
|
||||
Reference in New Issue
Block a user