mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-25 18:20:15 +00:00
refactor : 重构代码
This commit is contained in:
@@ -36,7 +36,7 @@ namespace YooAsset
|
||||
public void Register(Guid messageID, UnityAction<MessageEventArgs> callback)
|
||||
{
|
||||
if (messageID == Guid.Empty)
|
||||
throw new ArgumentException("messageID is empty !");
|
||||
throw new ArgumentException("messageID is empty.");
|
||||
|
||||
if (_messageCallbacks.ContainsKey(messageID) == false)
|
||||
_messageCallbacks.Add(messageID, callback);
|
||||
@@ -49,7 +49,7 @@ namespace YooAsset
|
||||
public void Send(Guid messageID, byte[] data)
|
||||
{
|
||||
if (messageID == Guid.Empty)
|
||||
throw new ArgumentException("messageID is empty !");
|
||||
throw new ArgumentException("messageID is empty.");
|
||||
|
||||
// 接收对方的消息
|
||||
RemotePlayerConnection.Instance.HandleEditorMessage(messageID, data);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace YooAsset
|
||||
public void Register(Guid messageID, UnityAction<MessageEventArgs> callback)
|
||||
{
|
||||
if (messageID == Guid.Empty)
|
||||
throw new ArgumentException("messageID is empty !");
|
||||
throw new ArgumentException("messageID is empty.");
|
||||
|
||||
if (_messageCallbacks.ContainsKey(messageID) == false)
|
||||
_messageCallbacks.Add(messageID, callback);
|
||||
@@ -49,7 +49,7 @@ namespace YooAsset
|
||||
public void Send(Guid messageID, byte[] data)
|
||||
{
|
||||
if (messageID == Guid.Empty)
|
||||
throw new ArgumentException("messageID is empty !");
|
||||
throw new ArgumentException("messageID is empty.");
|
||||
|
||||
// 接收对方的消息
|
||||
RemoteEditorConnection.Instance.HandlePlayerMessage(messageID, data);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace YooAsset
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(_args.FileHash))
|
||||
throw new YooInternalException("File hash is null or empty!");
|
||||
throw new YooInternalException("File hash is null or empty.");
|
||||
|
||||
// 使用 Unity 缓存
|
||||
// 说明:The file hash defining the version of the asset bundle.
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace YooAsset
|
||||
if (_webRequest == null)
|
||||
{
|
||||
Status = EDownloadRequestStatus.Failed;
|
||||
Error = $"[{GetType().Name}] Created web request is null!";
|
||||
Error = $"[{GetType().Name}] Created web request is null.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -226,7 +226,7 @@ namespace YooAsset
|
||||
protected void ApplyRequestOptions(int timeout, int watchdogTime, Dictionary<string, string> headers)
|
||||
{
|
||||
if (_webRequest == null)
|
||||
throw new YooInternalException("Web request is null!");
|
||||
throw new YooInternalException("Web request is null.");
|
||||
|
||||
// 设置看门狗超时时间
|
||||
_watchdogTime = watchdogTime;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace YooAsset
|
||||
#elif UNITY_STANDALONE_LINUX
|
||||
url = StringUtility.Format("file:///root/{0}", path);
|
||||
#else
|
||||
throw new System.NotSupportedException($"[{nameof(DownloadSystemHelper.ConvertToWWWPath)}] Platform '{UnityEngine.Application.platform}' is not supported!");
|
||||
throw new System.NotSupportedException($"[{nameof(DownloadSystemHelper.ConvertToWWWPath)}] Platform '{UnityEngine.Application.platform}' is not supported.");
|
||||
#endif
|
||||
|
||||
// For some special cases when users have special characters in their devices, url paths can not be identified correctly.
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace YooAsset
|
||||
if (_assetBundle == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs !";
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs.";
|
||||
Status = EOperationStatus.Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace YooAsset
|
||||
if (_assetBundle == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs !";
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs.";
|
||||
Status = EOperationStatus.Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
//注意:场景加载无法强制异步转同步
|
||||
YooLogger.Error("The scene is loading asyn !");
|
||||
YooLogger.Error("The scene is loading asyn.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace YooAsset
|
||||
if (_assetBundle == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs !";
|
||||
Error = $"The bundle {_packageBundle.BundleName} has been destroyed due to unity engine bugs.";
|
||||
Status = EOperationStatus.Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace YooAsset
|
||||
{
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadAllAssetsOperation)} not support load all assets !";
|
||||
Error = $"{nameof(RawBundleLoadAllAssetsOperation)} not support load all assets.";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace YooAsset
|
||||
{
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadAssetOperation)} not support load asset !";
|
||||
Error = $"{nameof(RawBundleLoadAssetOperation)} not support load asset.";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace YooAsset
|
||||
{
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadSceneOperation)} not support load scene !";
|
||||
Error = $"{nameof(RawBundleLoadSceneOperation)} not support load scene.";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace YooAsset
|
||||
{
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadSubAssetsOperation)} not support load sub assets !";
|
||||
Error = $"{nameof(RawBundleLoadSubAssetsOperation)} not support load sub assets.";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace YooAsset
|
||||
_steps = ESteps.CheckBundle;
|
||||
#else
|
||||
_steps = ESteps.Done;
|
||||
Error = $"{nameof(VirtualBundleLoadAllAssetsOperation)} only support unity editor platform !";
|
||||
Error = $"{nameof(VirtualBundleLoadAllAssetsOperation)} only support unity editor platform.";
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace YooAsset
|
||||
_steps = ESteps.CheckBundle;
|
||||
#else
|
||||
_steps = ESteps.Done;
|
||||
Error = $"{nameof(VirtualBundleLoadAssetOperation)} only support unity editor platform !";
|
||||
Error = $"{nameof(VirtualBundleLoadAssetOperation)} only support unity editor platform.";
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace YooAsset
|
||||
_steps = ESteps.LoadScene;
|
||||
#else
|
||||
_steps = ESteps.Done;
|
||||
Error = $"{nameof(VirtualBundleLoadSceneOperation)} only support unity editor platform !";
|
||||
Error = $"{nameof(VirtualBundleLoadSceneOperation)} only support unity editor platform.";
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
// 注意:场景加载无法强制异步转同步
|
||||
YooLogger.Error("The scene is loading asyn !");
|
||||
YooLogger.Error("The scene is loading asyn.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace YooAsset
|
||||
_steps = ESteps.CheckBundle;
|
||||
#else
|
||||
_steps = ESteps.Done;
|
||||
Error = $"{nameof(VirtualBundleLoadSubAssetsOperation)} only support unity editor platform !";
|
||||
Error = $"{nameof(VirtualBundleLoadSubAssetsOperation)} only support unity editor platform.";
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace YooAsset
|
||||
public static DefaultBuildinFileCatalog DeserializeFromBinary(byte[] binaryData)
|
||||
{
|
||||
if (binaryData == null || binaryData.Length == 0)
|
||||
throw new Exception("Catalog file data is null or empty !");
|
||||
throw new Exception("Catalog file data is null or empty.");
|
||||
|
||||
// 创建缓存器
|
||||
BufferReader buffer = new BufferReader(binaryData);
|
||||
@@ -214,7 +214,7 @@ namespace YooAsset
|
||||
// 读取文件标记
|
||||
uint fileSign = buffer.ReadUInt32();
|
||||
if (fileSign != CatalogFileDefine.FileSign)
|
||||
throw new Exception("Invalid catalog file !");
|
||||
throw new Exception("Invalid catalog file.");
|
||||
|
||||
// 读取文件版本
|
||||
string fileVersion = buffer.ReadUTF8();
|
||||
|
||||
@@ -333,14 +333,14 @@ namespace YooAsset
|
||||
|
||||
#if UNITY_ANDROID
|
||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
||||
YooLogger.Error($"Android platform not support read buildin bundle file data !");
|
||||
YooLogger.Error($"Android platform not support read buildin bundle file data.");
|
||||
return null;
|
||||
#else
|
||||
if (bundle.Encrypted)
|
||||
{
|
||||
if (DecryptionServices == null)
|
||||
{
|
||||
YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
|
||||
YooLogger.Error($"The {nameof(IDecryptionServices)} is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -370,14 +370,14 @@ namespace YooAsset
|
||||
|
||||
#if UNITY_ANDROID
|
||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
||||
YooLogger.Error($"Android platform not support read buildin bundle file text !");
|
||||
YooLogger.Error($"Android platform not support read buildin bundle file text.");
|
||||
return null;
|
||||
#else
|
||||
if (bundle.Encrypted)
|
||||
{
|
||||
if (DecryptionServices == null)
|
||||
{
|
||||
YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
|
||||
YooLogger.Error($"The {nameof(IDecryptionServices)} is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace YooAsset
|
||||
#if UNITY_WEBGL
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(DefaultBuildinFileSystem)} is not support WEBGL platform !";
|
||||
Error = $"{nameof(DefaultBuildinFileSystem)} is not support WEBGL platform.";
|
||||
#else
|
||||
if (_fileSystem.CopyBuildinPackageManifest)
|
||||
_steps = ESteps.LoadBuildinPackageVersion;
|
||||
@@ -181,7 +181,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Fatal error : catalog is null !";
|
||||
Error = "Fatal error : catalog is null.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The {nameof(IBundleDecryptionServices)} is null !";
|
||||
Error = $"The {nameof(IBundleDecryptionServices)} is null.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The {nameof(IDecryptionServices)} is null !";
|
||||
Error = $"The {nameof(IDecryptionServices)} is null.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify buildin package manifest file !";
|
||||
Error = "Failed to verify buildin package manifest file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Buildin package hash file content is empty !";
|
||||
Error = $"Buildin package hash file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Buildin package version file content is empty !";
|
||||
Error = $"Buildin package version file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace YooAsset
|
||||
{
|
||||
if (BundleDecryptionServices == null)
|
||||
{
|
||||
YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null !");
|
||||
YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace YooAsset
|
||||
{
|
||||
if (BundleDecryptionServices == null)
|
||||
{
|
||||
YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null !");
|
||||
YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ namespace YooAsset
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
YooLogger.Error($"Failed to write cache file ! {ex.Message}");
|
||||
YooLogger.Error($"Failed to write cache file. Error: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace YooAsset
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
YooLogger.Error($"Failed to delete cache file ! {ex.Message}");
|
||||
YooLogger.Error($"Failed to delete cache file. Error: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace YooAsset
|
||||
#if UNITY_WEBGL
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(DefaultCacheFileSystem)} is not support WEBGL platform !";
|
||||
Error = $"{nameof(DefaultCacheFileSystem)} is not support WEBGL platform.";
|
||||
#else
|
||||
_steps = ESteps.CheckAppFootPrint;
|
||||
#endif
|
||||
@@ -48,23 +48,23 @@ namespace YooAsset
|
||||
{
|
||||
if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.None)
|
||||
{
|
||||
YooLogger.Warning("Do nothing when overwrite install application !");
|
||||
YooLogger.Warning("Do nothing when overwrite install application.");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllCacheFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllBundleFiles();
|
||||
_fileSystem.DeleteAllManifestFiles();
|
||||
YooLogger.Warning("Delete all cache files when overwrite install application !");
|
||||
YooLogger.Warning("Delete all cache files when overwrite install application.");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllBundleFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllBundleFiles();
|
||||
YooLogger.Warning("Delete all bundle files when overwrite install application !");
|
||||
YooLogger.Warning("Delete all bundle files when overwrite install application.");
|
||||
}
|
||||
else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllManifestFiles)
|
||||
{
|
||||
_fileSystem.DeleteAllManifestFiles();
|
||||
YooLogger.Warning("Delete all manifest files when overwrite install application !");
|
||||
YooLogger.Warning("Delete all manifest files when overwrite install application.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace YooAsset
|
||||
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Abort download file !";
|
||||
Error = "Abort download file.";
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadAssetBundle)
|
||||
@@ -131,7 +131,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The {nameof(IBundleDecryptionServices)} is null !";
|
||||
Error = $"The {nameof(IBundleDecryptionServices)} is null.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ namespace YooAsset
|
||||
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Abort download file !";
|
||||
Error = "Abort download file.";
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadCacheRawBundle)
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Can not found active package manifest !";
|
||||
Error = "Can not found active package manifest.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Clear param is null !";
|
||||
Error = "Clear param is null.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Can not found active package manifest !";
|
||||
Error = "Can not found active package manifest.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Clear param is null !";
|
||||
Error = "Clear param is null.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Can not found active package manifest !";
|
||||
Error = "Can not found active package manifest.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Can not found active package manifest !";
|
||||
Error = "Can not found active package manifest.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Download file options is invalid !";
|
||||
Error = "Download file options is invalid.";
|
||||
Debug.Log(Error);
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete == false && _failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_downloadFileOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_downloadFileOp.URL} Try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Cache package hash file content is empty !";
|
||||
Error = $"Cache package hash file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify cache package manifest file!";
|
||||
Error = "Failed to verify cache package manifest file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Remote package version file content is empty !";
|
||||
Error = $"Remote package version file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file !";
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file.";
|
||||
}
|
||||
|
||||
// 注意:缓存完成后直接删除临时文件
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file !";
|
||||
Error = $"{_fileSystem.GetType().FullName} failed to write file.";
|
||||
}
|
||||
|
||||
// 注意:缓存完成后直接删除临时文件
|
||||
@@ -151,7 +151,7 @@ namespace YooAsset
|
||||
if (_steps != ESteps.Done)
|
||||
{
|
||||
// 注意:不中断下载任务,保持后台继续下载
|
||||
YooLogger.Error($"Try load bundle {_bundle.BundleName} from remote : {URL} !");
|
||||
YooLogger.Error($"Try load bundle {_bundle.BundleName} from remote : {URL}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Failed to verify file : {_element.TempFilePath} ! ErrorCode : {VerifyResult}";
|
||||
Error = $"Failed to verify file : {_element.TempFilePath} ErrorCode : {VerifyResult}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace YooAsset
|
||||
PackageName = packageName;
|
||||
|
||||
if (string.IsNullOrEmpty(packageRoot))
|
||||
throw new YooFileSystemException($"{nameof(DefaultEditorFileSystem)} package root is null or empty !");
|
||||
throw new YooFileSystemException($"{nameof(DefaultEditorFileSystem)} package root is null or empty.");
|
||||
|
||||
_packageRoot = packageRoot;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace YooAsset
|
||||
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Abort download file !";
|
||||
Error = "Abort download file.";
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadAssetBundle)
|
||||
@@ -116,7 +116,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Virtual WebGL Mode only support asyn load method !";
|
||||
Error = "Virtual WebGL Mode only support asyn load method.";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Download file options is invalid !";
|
||||
Error = "Download file options is invalid.";
|
||||
Debug.Log(Error);
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete == false && _failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_downloadFileOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_downloadFileOp.URL} Try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,7 +127,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Try load bundle {Bundle.BundleName} from remote !";
|
||||
Error = $"Try load bundle {Bundle.BundleName} from remote.";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify simulation package manifest file !";
|
||||
Error = "Failed to verify simulation package manifest file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(DWRFSLoadAssetBundleOperation)} loaded asset bundle is null !";
|
||||
Error = $"{nameof(DWRFSLoadAssetBundleOperation)} loaded asset bundle is null.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -90,7 +90,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "WebGL platform not support sync load method !";
|
||||
Error = "WebGL platform not support sync load method.";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(DWSFSLoadAssetBundleOperation)} loaded asset bundle is null !";
|
||||
Error = $"{nameof(DWSFSLoadAssetBundleOperation)} loaded asset bundle is null.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -90,7 +90,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "WebGL platform not support sync load method !";
|
||||
Error = "WebGL platform not support sync load method.";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify web server package manifest file!";
|
||||
Error = "Failed to verify web server package manifest file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Web server package hash file content is empty !";
|
||||
Error = $"Web server package hash file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Web server package version file content is empty !";
|
||||
Error = $"Web server package version file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The {nameof(IWebBundleDecryptionServices)} is null !";
|
||||
Error = $"The {nameof(IWebBundleDecryptionServices)} is null.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed load encrypted AssetBundle !";
|
||||
Error = "Failed load encrypted AssetBundle.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace YooAsset
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_unityWebDataRequestOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_unityWebDataRequestOp.URL} Try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace YooAsset
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
_steps = ESteps.TryAgain;
|
||||
YooLogger.Warning($"Failed download : {_unityAssetBundleRequestOp.URL} Try again !");
|
||||
YooLogger.Warning($"Failed download : {_unityAssetBundleRequestOp.URL} Try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ internal class LoadWebPackageManifestOperation : AsyncOperationBase
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to verify web package manifest file!";
|
||||
Error = "Failed to verify web package manifest file.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ internal class RequestWebPackageHashOperation : AsyncOperationBase
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Web package hash file content is empty !";
|
||||
Error = $"Web package hash file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ internal class RequestWebPackageVersionOperation : AsyncOperationBase
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Web package version file content is empty !";
|
||||
Error = $"Web package version file content is empty.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -158,13 +158,13 @@ namespace YooAsset
|
||||
|
||||
#if UNITY_EDITOR || DEBUG
|
||||
if (child == null)
|
||||
throw new YooInternalException("The child node is null !");
|
||||
throw new YooInternalException("The child node is null.");
|
||||
|
||||
if (ReferenceEquals(child, this))
|
||||
throw new YooInternalException("The child node cannot be itself !");
|
||||
throw new YooInternalException("The child node cannot be itself.");
|
||||
|
||||
if (_childs.Contains(child))
|
||||
throw new YooInternalException($"The child node {child.GetType().Name} already exists !");
|
||||
throw new YooInternalException($"The child node {child.GetType().Name} already exists.");
|
||||
|
||||
// 禁止形成环依赖
|
||||
if (WouldCreateCycle(child))
|
||||
@@ -184,10 +184,10 @@ namespace YooAsset
|
||||
|
||||
#if UNITY_EDITOR || DEBUG
|
||||
if (child == null)
|
||||
throw new YooInternalException("The child node is null !");
|
||||
throw new YooInternalException("The child node is null.");
|
||||
|
||||
if (_childs.Contains(child) == false)
|
||||
throw new YooInternalException($"The child node {child.GetType().Name} not exists !");
|
||||
throw new YooInternalException($"The child node {child.GetType().Name} not exists.");
|
||||
#endif
|
||||
|
||||
_childs.Remove(child);
|
||||
@@ -276,7 +276,7 @@ namespace YooAsset
|
||||
InternalAbort();
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "user abort";
|
||||
YooLogger.Warning($"Async operation {this.GetType().Name} has been aborted !");
|
||||
YooLogger.Warning($"Async operation {this.GetType().Name} has been aborted.");
|
||||
}
|
||||
|
||||
//注意:强制收尾,确保Task能完成
|
||||
@@ -398,7 +398,7 @@ namespace YooAsset
|
||||
if (IsDone == false)
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Operation {this.GetType().Name} failed to wait for async complete !";
|
||||
Error = $"Operation {this.GetType().Name} failed to wait for async complete.";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ namespace YooAsset
|
||||
|
||||
// 防止无限循环(图过大)
|
||||
if (visited.Count > MaxCycleCheckDepth)
|
||||
throw new YooInternalException("Child operation graph is too large, cycle check aborted !");
|
||||
throw new YooInternalException("Child operation graph is too large, cycle check aborted.");
|
||||
|
||||
// 检测循环:如果遍历到自己,说明形成循环
|
||||
if (ReferenceEquals(node, this))
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace YooAsset
|
||||
{
|
||||
if (_isInitialized)
|
||||
{
|
||||
YooLogger.Warning("Operation system is already initialized!");
|
||||
YooLogger.Warning("Operation system is already initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace YooAsset
|
||||
// 不允许销毁默认调度器
|
||||
if (packageName == GlobalSchedulerName)
|
||||
{
|
||||
throw new YooInternalException("Cannot destroy the global package scheduler!");
|
||||
throw new YooInternalException("Cannot destroy the global package scheduler.");
|
||||
}
|
||||
|
||||
if (_schedulerDic.TryGetValue(packageName, out var scheduler))
|
||||
@@ -261,7 +261,7 @@ namespace YooAsset
|
||||
throw new YooInternalException("Package name is null or empty.");
|
||||
|
||||
if (_isInitialized == false)
|
||||
throw new YooInternalException($"{nameof(OperationSystem)} not initialized !");
|
||||
throw new YooInternalException($"{nameof(OperationSystem)} not initialized.");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Instantiate game object is null !";
|
||||
Error = $"Instantiate game object is null.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"Instantiate async results is null !";
|
||||
Error = $"Instantiate async results is null.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace YooAsset
|
||||
if (_loadBundleOp == null)
|
||||
{
|
||||
// 统计计数增加
|
||||
_resManager.BundleLoadingCounter++;
|
||||
_resManager.IncrementBundleLoadingCounter();
|
||||
_loadBundleOp = LoadBundleInfo.CreateBundleLoader();
|
||||
_loadBundleOp.StartOperation();
|
||||
AddChildOperation(_loadBundleOp);
|
||||
@@ -105,7 +105,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"The bundle loader result is null ! {LoadBundleInfo.Bundle.BundleName}";
|
||||
Error = $"The bundle loader result is null. Bundle: {LoadBundleInfo.Bundle.BundleName}";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
// 统计计数减少
|
||||
_resManager.BundleLoadingCounter--;
|
||||
_resManager.DecrementBundleLoadingCounter();
|
||||
}
|
||||
}
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
@@ -171,7 +171,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Bundle loader destroyed !";
|
||||
Error = "Bundle loader destroyed.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Abort bundle loader !";
|
||||
Error = "Bundle loader aborted.";
|
||||
}
|
||||
|
||||
if (_steps == ESteps.LoadBundleFile)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Scene is invalid !";
|
||||
Error = "Scene is invalid.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Scene is not loaded !";
|
||||
Error = "Scene is not loaded.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Unload scene failed, see the console logs !";
|
||||
Error = "Unload scene failed, see the console logs.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace YooAsset
|
||||
BundleResultObject = _mainBundleLoader.Result;
|
||||
if (BundleResultObject == null)
|
||||
{
|
||||
string error = $"Loaded bundle result is null !";
|
||||
string error = $"Loaded bundle result is null.";
|
||||
InvokeCompletion(error, EOperationStatus.Failed);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,18 +7,24 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源管理器
|
||||
/// 注意:此类不是线程安全的,所有方法必须在Unity主线程调用
|
||||
/// </summary>
|
||||
internal class ResourceManager
|
||||
{
|
||||
internal readonly Dictionary<string, ProviderOperation> ProviderDic = new Dictionary<string, ProviderOperation>(5000);
|
||||
internal readonly Dictionary<string, LoadBundleOperation> LoaderDic = new Dictionary<string, LoadBundleOperation>(5000);
|
||||
internal readonly List<SceneHandle> SceneHandles = new List<SceneHandle>(100);
|
||||
private readonly List<SceneHandle> _tempSceneHandles = new List<SceneHandle>(100);
|
||||
private FileSystemHost _fileSystemHost;
|
||||
private long _sceneCreateIndex = 0;
|
||||
private int _bundleLoadingMaxConcurrency;
|
||||
|
||||
private int _bundleLoadingCounter;
|
||||
private long _sceneCreateIndex;
|
||||
|
||||
// 开发者配置选项
|
||||
public bool AutoUnloadBundleWhenUnused { private set; get; }
|
||||
public bool WebGLForceSyncLoadAsset { private set; get; }
|
||||
public bool AutoUnloadBundleWhenUnused { get; private set; }
|
||||
public bool WebGLForceSyncLoadAsset { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属包裹
|
||||
@@ -30,12 +36,6 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public bool LockLoadOperation = false;
|
||||
|
||||
/// <summary>
|
||||
/// 统计正在加载的Bundle文件数量
|
||||
/// </summary>
|
||||
public int BundleLoadingCounter = 0;
|
||||
|
||||
|
||||
public ResourceManager(string packageName)
|
||||
{
|
||||
PackageName = packageName;
|
||||
@@ -68,18 +68,21 @@ namespace YooAsset
|
||||
{
|
||||
if (assetInfo == null)
|
||||
{
|
||||
YooLogger.Error($"{nameof(AssetInfo)} is null !");
|
||||
YooLogger.Error($"{nameof(AssetInfo)} is null.");
|
||||
return;
|
||||
}
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to unload asset ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to unload asset. Error: {assetInfo.Error}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 多次循环尝试卸载,以处理复杂的依赖链
|
||||
// 例如:A依赖B,B依赖C,需要多次循环才能完全卸载
|
||||
while (loopCount > 0)
|
||||
{
|
||||
loopCount--;
|
||||
bool hasUnloaded = false;
|
||||
|
||||
// 卸载主资源包加载器
|
||||
string mainBundleName = _fileSystemHost.GetMainBundleName(assetInfo.Asset.BundleID);
|
||||
@@ -91,6 +94,7 @@ namespace YooAsset
|
||||
{
|
||||
mainLoader.DestroyLoader();
|
||||
LoaderDic.Remove(mainBundleName);
|
||||
hasUnloaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +109,14 @@ namespace YooAsset
|
||||
{
|
||||
dependLoader.DestroyLoader();
|
||||
LoaderDic.Remove(dependBundleName);
|
||||
hasUnloaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果本次循环没有卸载任何资源,提前退出
|
||||
if (hasUnloaded == false)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +129,7 @@ namespace YooAsset
|
||||
{
|
||||
if (LockLoadOperation)
|
||||
{
|
||||
string error = $"The load operation locked !";
|
||||
string error = $"The load operation locked.";
|
||||
YooLogger.Error(error);
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(error);
|
||||
@@ -129,7 +138,7 @@ namespace YooAsset
|
||||
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to load scene ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to load scene. Error: {assetInfo.Error}");
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(assetInfo.Error);
|
||||
return completedProvider.CreateHandle<SceneHandle>();
|
||||
@@ -159,7 +168,7 @@ namespace YooAsset
|
||||
{
|
||||
if (LockLoadOperation)
|
||||
{
|
||||
string error = $"The load operation locked !";
|
||||
string error = $"The load operation locked.";
|
||||
YooLogger.Error(error);
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(error);
|
||||
@@ -168,7 +177,7 @@ namespace YooAsset
|
||||
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to load asset ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to load asset. Error: {assetInfo.Error}");
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(assetInfo.Error);
|
||||
return completedProvider.CreateHandle<AssetHandle>();
|
||||
@@ -195,7 +204,7 @@ namespace YooAsset
|
||||
{
|
||||
if (LockLoadOperation)
|
||||
{
|
||||
string error = $"The load operation locked !";
|
||||
string error = $"The load operation locked.";
|
||||
YooLogger.Error(error);
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(error);
|
||||
@@ -204,7 +213,7 @@ namespace YooAsset
|
||||
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to load sub assets ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to load sub assets. Error: {assetInfo.Error}");
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(assetInfo.Error);
|
||||
return completedProvider.CreateHandle<SubAssetsHandle>();
|
||||
@@ -231,7 +240,7 @@ namespace YooAsset
|
||||
{
|
||||
if (LockLoadOperation)
|
||||
{
|
||||
string error = $"The load operation locked !";
|
||||
string error = $"The load operation locked.";
|
||||
YooLogger.Error(error);
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(error);
|
||||
@@ -240,7 +249,7 @@ namespace YooAsset
|
||||
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to load all assets ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to load all assets. Error: {assetInfo.Error}");
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(assetInfo.Error);
|
||||
return completedProvider.CreateHandle<AllAssetsHandle>();
|
||||
@@ -267,7 +276,7 @@ namespace YooAsset
|
||||
{
|
||||
if (LockLoadOperation)
|
||||
{
|
||||
string error = $"The load operation locked !";
|
||||
string error = $"The load operation locked.";
|
||||
YooLogger.Error(error);
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(error);
|
||||
@@ -276,7 +285,7 @@ namespace YooAsset
|
||||
|
||||
if (assetInfo.IsInvalid)
|
||||
{
|
||||
YooLogger.Error($"Failed to load raw file ! {assetInfo.Error}");
|
||||
YooLogger.Error($"Failed to load raw file. Error: {assetInfo.Error}");
|
||||
CompletedProvider completedProvider = new CompletedProvider(this, assetInfo);
|
||||
completedProvider.SetCompletedWithError(assetInfo.Error);
|
||||
return completedProvider.CreateHandle<RawFileHandle>();
|
||||
@@ -339,9 +348,26 @@ namespace YooAsset
|
||||
{
|
||||
return LoaderDic.Count > 0;
|
||||
}
|
||||
internal void IncrementBundleLoadingCounter()
|
||||
{
|
||||
_bundleLoadingCounter++;
|
||||
}
|
||||
internal void DecrementBundleLoadingCounter()
|
||||
{
|
||||
_bundleLoadingCounter--;
|
||||
if (_bundleLoadingCounter < 0)
|
||||
{
|
||||
YooLogger.Error("BundleLoadingCounter is negative.");
|
||||
_bundleLoadingCounter = 0;
|
||||
}
|
||||
}
|
||||
internal int GetBundleLoadingCounter()
|
||||
{
|
||||
return _bundleLoadingCounter;
|
||||
}
|
||||
internal bool BundleLoadingIsBusy()
|
||||
{
|
||||
return BundleLoadingCounter >= _bundleLoadingMaxConcurrency;
|
||||
return _bundleLoadingCounter >= _bundleLoadingMaxConcurrency;
|
||||
}
|
||||
|
||||
private LoadBundleOperation CreateBundleFileLoaderInternal(BundleInfo bundleInfo)
|
||||
@@ -373,7 +399,7 @@ namespace YooAsset
|
||||
}
|
||||
private void OnSceneUnloaded(Scene scene)
|
||||
{
|
||||
List<SceneHandle> removeList = new List<SceneHandle>();
|
||||
_tempSceneHandles.Clear(); //复用列表
|
||||
foreach (var sceneHandle in SceneHandles)
|
||||
{
|
||||
if (sceneHandle.IsValid)
|
||||
@@ -381,11 +407,11 @@ namespace YooAsset
|
||||
if (sceneHandle.SceneObject == scene)
|
||||
{
|
||||
sceneHandle.Release();
|
||||
removeList.Add(sceneHandle);
|
||||
_tempSceneHandles.Add(sceneHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var sceneHandle in removeList)
|
||||
foreach (var sceneHandle in _tempSceneHandles)
|
||||
{
|
||||
SceneHandles.Remove(sceneHandle);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace YooAsset
|
||||
var fileSystem = GetBelongFileSystem(packageBundle);
|
||||
if (fileSystem != null)
|
||||
{
|
||||
BundleInfo bundleInfo = new BundleInfo(fileSystem, packageBundle);
|
||||
var bundleInfo = new BundleInfo(fileSystem, packageBundle);
|
||||
return bundleInfo;
|
||||
}
|
||||
|
||||
@@ -209,9 +209,9 @@ namespace YooAsset
|
||||
{
|
||||
List<BundleInfo> downloadList;
|
||||
if (options.Tags == null)
|
||||
downloadList = GetBundleListByAll(manifest, NeedDownload);
|
||||
downloadList = GetBundleInfoListByAll(manifest, NeedDownload);
|
||||
else
|
||||
downloadList = GetBundleListByTags(manifest, options.Tags, NeedDownload);
|
||||
downloadList = GetBundleInfoListByTags(manifest, options.Tags, NeedDownload);
|
||||
|
||||
var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
|
||||
return operation;
|
||||
@@ -225,9 +225,9 @@ namespace YooAsset
|
||||
{
|
||||
List<BundleInfo> downloadList;
|
||||
if (options.AssetInfos == null)
|
||||
downloadList = GetBundleListByAll(manifest, NeedDownload);
|
||||
downloadList = GetBundleInfoListByAll(manifest, NeedDownload);
|
||||
else
|
||||
downloadList = GetBundleListByAssetInfos(manifest, options.AssetInfos, options.DownloadBundleDependencies, NeedDownload);
|
||||
downloadList = GetBundleInfoListByAssetInfos(manifest, options.AssetInfos, options.DownloadBundleDependencies, NeedDownload);
|
||||
|
||||
var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
|
||||
return operation;
|
||||
@@ -241,9 +241,9 @@ namespace YooAsset
|
||||
{
|
||||
List<BundleInfo> unpackList;
|
||||
if (options.Tags == null)
|
||||
unpackList = GetBundleListByAll(manifest, NeedUnpack);
|
||||
unpackList = GetBundleInfoListByAll(manifest, NeedUnpack);
|
||||
else
|
||||
unpackList = GetBundleListByTags(manifest, options.Tags, NeedUnpack);
|
||||
unpackList = GetBundleInfoListByTags(manifest, options.Tags, NeedUnpack);
|
||||
|
||||
var operation = new ResourceUnpackerOperation(PackageName, unpackList, options.MaximumConcurrency, options.FailedTryAgain);
|
||||
return operation;
|
||||
@@ -255,12 +255,12 @@ namespace YooAsset
|
||||
}
|
||||
public ResourceImporterOperation CreateResourceImporter(PackageManifest manifest, BundleImporterOptions options)
|
||||
{
|
||||
List<BundleInfo> importerList = GetBundleListByBundleInfos(manifest, options.BundleInfos, NeedImport);
|
||||
List<BundleInfo> importerList = GetBundleInfoListByBundleInfos(manifest, options.BundleInfos, NeedImport);
|
||||
var operation = new ResourceImporterOperation(PackageName, importerList, options.MaximumConcurrency, options.FailedTryAgain);
|
||||
return operation;
|
||||
}
|
||||
|
||||
private List<BundleInfo> GetBundleListByAll(PackageManifest manifest, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
private List<BundleInfo> GetBundleInfoListByAll(PackageManifest manifest, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
{
|
||||
if (manifest == null)
|
||||
return new List<BundleInfo>();
|
||||
@@ -280,7 +280,7 @@ namespace YooAsset
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private List<BundleInfo> GetBundleListByTags(PackageManifest manifest, string[] tags, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
private List<BundleInfo> GetBundleInfoListByTags(PackageManifest manifest, string[] tags, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
{
|
||||
if (manifest == null)
|
||||
return new List<BundleInfo>();
|
||||
@@ -312,7 +312,7 @@ namespace YooAsset
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private List<BundleInfo> GetBundleListByAssetInfos(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDepend, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
private List<BundleInfo> GetBundleInfoListByAssetInfos(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDepend, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
{
|
||||
if (manifest == null)
|
||||
return new List<BundleInfo>();
|
||||
@@ -387,7 +387,7 @@ namespace YooAsset
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private List<BundleInfo> GetBundleListByBundleInfos(PackageManifest manifest, ImportBundleInfo[] fileInfos, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
private List<BundleInfo> GetBundleInfoListByBundleInfos(PackageManifest manifest, ImportBundleInfo[] fileInfos, Func<IFileSystem, PackageBundle, bool> predicate)
|
||||
{
|
||||
if (manifest == null)
|
||||
return new List<BundleInfo>();
|
||||
|
||||
@@ -36,27 +36,27 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.Prepare)
|
||||
{
|
||||
var fileSytems = _host.FileSystems;
|
||||
if (fileSytems == null || fileSytems.Count == 0)
|
||||
var fileSystems = _host.FileSystems;
|
||||
if (fileSystems == null || fileSystems.Count == 0)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "The file system is empty !";
|
||||
Error = "The file system is empty.";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var fileSystem in fileSytems)
|
||||
foreach (var fileSystem in fileSystems)
|
||||
{
|
||||
if (fileSystem == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "An empty object exists in the list!";
|
||||
Error = "An empty object exists in the list.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_cloneList = fileSytems.ToList();
|
||||
_cloneList = fileSystems.ToList();
|
||||
_steps = ESteps.ClearCacheFiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "The Package is initializing ! Please try to destroy the package again later.";
|
||||
Error = "The Package is initializing. Please try to destroy the package again later.";
|
||||
}
|
||||
else if (_resourcePackage.InitializeStatus == EOperationStatus.Failed)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace YooAsset
|
||||
_failedTryAgain = failedTryAgain;
|
||||
|
||||
// 统计下载信息
|
||||
CalculatDownloaderInfo();
|
||||
CalculateDownloaderInfo();
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
@@ -262,7 +262,7 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
private void CalculatDownloaderInfo()
|
||||
private void CalculateDownloaderInfo()
|
||||
{
|
||||
if (_bundleInfoList != null)
|
||||
{
|
||||
@@ -288,23 +288,23 @@ namespace YooAsset
|
||||
{
|
||||
if (_packageName != downloader._packageName)
|
||||
{
|
||||
YooLogger.Error("The downloaders have different resource packages !");
|
||||
YooLogger.Error("The downloaders have different resource packages.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Status != EOperationStatus.None)
|
||||
{
|
||||
YooLogger.Error("The downloader is running, can not combine with other downloader !");
|
||||
YooLogger.Error("The downloader is running, can not combine with other downloader.");
|
||||
return;
|
||||
}
|
||||
|
||||
HashSet<string> temper = new HashSet<string>();
|
||||
HashSet<string> combineGuidSet = new HashSet<string>();
|
||||
foreach (var bundleInfo in _bundleInfoList)
|
||||
{
|
||||
string combineGUID = bundleInfo.GetDownloadCombineGUID();
|
||||
if (temper.Contains(combineGUID) == false)
|
||||
if (combineGuidSet.Contains(combineGUID) == false)
|
||||
{
|
||||
temper.Add(combineGUID);
|
||||
combineGuidSet.Add(combineGUID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,14 +312,14 @@ namespace YooAsset
|
||||
foreach (var bundleInfo in downloader._bundleInfoList)
|
||||
{
|
||||
string combineGUID = bundleInfo.GetDownloadCombineGUID();
|
||||
if (temper.Contains(combineGUID) == false)
|
||||
if (combineGuidSet.Contains(combineGUID) == false)
|
||||
{
|
||||
_bundleInfoList.Add(bundleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 重新统计下载信息
|
||||
CalculatDownloaderInfo();
|
||||
CalculateDownloaderInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{_playMode} can not support WebGL plateform !";
|
||||
Error = $"{_playMode} can not support WebGL plateform.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = $"{nameof(EPlayMode.WebPlayMode)} only support WebGL plateform !";
|
||||
Error = $"{nameof(EPlayMode.WebPlayMode)} only support WebGL plateform.";
|
||||
YooLogger.Error(Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 解析的清单实例
|
||||
/// </summary>
|
||||
public PackageManifest Manifest { private set; get; }
|
||||
public PackageManifest Manifest { get; private set; }
|
||||
|
||||
public DeserializeManifestOperation(IManifestRestoreServices services, byte[] binaryData)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Buffer is invalid !";
|
||||
Error = "Buffer is invalid.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "The manifest file format is invalid !";
|
||||
Error = "The manifest file format is invalid.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ namespace YooAsset
|
||||
|
||||
// 检测配置
|
||||
if (Manifest.EnableAddressable && Manifest.LocationToLower)
|
||||
throw new YooManifestException("Addressable not support location to lower !");
|
||||
throw new YooManifestException("Addressable not support location to lower.");
|
||||
if (Manifest.EnableAddressable == false && Manifest.ReplaceAssetPathWithAddress)
|
||||
throw new YooManifestException("Replace asset path with address need enable Addressable !");
|
||||
throw new YooManifestException("Replace asset path with address need enable Addressable.");
|
||||
|
||||
_steps = ESteps.PrepareAssetList;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "The file system parameters is empty !";
|
||||
Error = "The file system parameters is empty.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "An empty object exists in the list!";
|
||||
Error = "An empty object exists in the list.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ namespace YooAsset
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "Failed to create file system instance !";
|
||||
Error = "Failed to create file system instance.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace YooAsset
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
YooLogger.Error($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||
YooLogger.Error($"{nameof(PreDownloadContentOperation)} status is not succeed.");
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace YooAsset
|
||||
{
|
||||
if (Status != EOperationStatus.Succeed)
|
||||
{
|
||||
YooLogger.Error($"{nameof(PreDownloadContentOperation)} status is not succeed !");
|
||||
YooLogger.Error($"{nameof(PreDownloadContentOperation)} status is not succeed.");
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName);
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace YooAsset
|
||||
{
|
||||
string error;
|
||||
if (string.IsNullOrEmpty(location))
|
||||
error = $"The location is null or empty !";
|
||||
error = $"The location is null or empty.";
|
||||
else
|
||||
error = $"The location is invalid : {location}";
|
||||
AssetInfo assetInfo = new AssetInfo(PackageName, error);
|
||||
@@ -369,8 +369,8 @@ namespace YooAsset
|
||||
{
|
||||
if (IncludeAssetGUID == false)
|
||||
{
|
||||
YooLogger.Warning("Package manifest not include asset guid ! Please check asset bundle collector settings.");
|
||||
AssetInfo assetInfo = new AssetInfo(PackageName, "AssetGUID data is empty !");
|
||||
YooLogger.Warning("Package manifest not include asset guid. Please check asset bundle collector settings.");
|
||||
AssetInfo assetInfo = new AssetInfo(PackageName, "AssetGUID data is empty.");
|
||||
return assetInfo;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace YooAsset
|
||||
{
|
||||
string error;
|
||||
if (string.IsNullOrEmpty(assetGUID))
|
||||
error = $"The assetGUID is null or empty !";
|
||||
error = $"The assetGUID is null or empty.";
|
||||
else
|
||||
error = $"The assetGUID is invalid : {assetGUID}";
|
||||
AssetInfo assetInfo = new AssetInfo(PackageName, error);
|
||||
|
||||
@@ -19,10 +19,5 @@ namespace YooAsset
|
||||
public const string FileVersion = "2025.9.30";
|
||||
public const string VERSION_2025_8_28 = "2025.8.28";
|
||||
public const string VERSION_2025_9_30 = "2025.9.30";
|
||||
|
||||
/// <summary>
|
||||
/// 版本兼容
|
||||
/// </summary>
|
||||
public const bool BackwardCompatible = true;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ namespace YooAsset
|
||||
{
|
||||
internal static class PackageManifestTools
|
||||
{
|
||||
private const int MD5HashLength = 32; //MD5的哈希值通常为32个字符
|
||||
|
||||
/// <summary>
|
||||
/// 验证清单文件的二进制数据
|
||||
/// </summary>
|
||||
@@ -19,9 +21,8 @@ namespace YooAsset
|
||||
return false;
|
||||
|
||||
// 注意:兼容俩种验证方式
|
||||
// 注意:计算MD5的哈希值通常为32个字符
|
||||
string fileHash;
|
||||
if (hashValue.Length == 32)
|
||||
if (hashValue.Length == MD5HashLength)
|
||||
fileHash = HashUtility.BytesMD5(fileData);
|
||||
else
|
||||
fileHash = HashUtility.BytesCRC32(fileData);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace YooAsset
|
||||
|
||||
// 检测重复初始化
|
||||
if (_initializeOp != null)
|
||||
throw new YooPackageException(PackageName, $"Resource package '{PackageName}' is already initialized!");
|
||||
throw new YooPackageException(PackageName, $"Resource package '{PackageName}' is already initialized.");
|
||||
|
||||
// 开始初始化操作
|
||||
_initializeOp = new InitializePackageOperation(this, options);
|
||||
@@ -149,7 +149,7 @@ namespace YooAsset
|
||||
// 注意:强烈建议在更新之前保持加载器为空!
|
||||
if (_resourceManager.HasAnyLoader())
|
||||
{
|
||||
YooLogger.Warning($"Found loaded bundle before update manifest ! Recommended to call the {nameof(UnloadAllAssetsAsync)} method to release loaded bundle !");
|
||||
YooLogger.Warning($"Found loaded bundle before update manifest. Recommended to call the {nameof(UnloadAllAssetsAsync)} method to release loaded bundle.");
|
||||
}
|
||||
|
||||
var operation = new LoadPackageManifestOperation(_fileSystemHost, options);
|
||||
@@ -891,23 +891,23 @@ namespace YooAsset
|
||||
{
|
||||
if (InitializeStatus == EOperationStatus.None)
|
||||
{
|
||||
throw new YooPackageException(PackageName, "Resource package not initialized!");
|
||||
throw new YooPackageException(PackageName, "Resource package not initialized.");
|
||||
}
|
||||
else if (InitializeStatus == EOperationStatus.Processing)
|
||||
{
|
||||
throw new YooPackageException(PackageName, "Resource package initialization not completed!");
|
||||
throw new YooPackageException(PackageName, "Resource package initialization not completed.");
|
||||
}
|
||||
else if (InitializeStatus == EOperationStatus.Failed)
|
||||
{
|
||||
string error = _initializeOp == null ? string.Empty : _initializeOp.Error;
|
||||
throw new YooPackageException(PackageName, $"Resource package initialization failed! Error: {error}");
|
||||
throw new YooPackageException(PackageName, $"Resource package initialization failed. Error: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
if (checkActiveManifest)
|
||||
{
|
||||
if (_fileSystemHost.ActiveManifest == null)
|
||||
throw new YooPackageException(PackageName, "Cannot found active package manifest!");
|
||||
throw new YooPackageException(PackageName, "Cannot found active package manifest.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace YooAsset
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(value);
|
||||
int count = bytes.Length;
|
||||
if (count > ushort.MaxValue)
|
||||
throw new FormatException($"Write string length cannot be greater than {ushort.MaxValue} !");
|
||||
throw new FormatException($"Write string length cannot be greater than {ushort.MaxValue}");
|
||||
|
||||
WriteUInt16(Convert.ToUInt16(count));
|
||||
WriteBytes(bytes);
|
||||
@@ -137,7 +137,7 @@ namespace YooAsset
|
||||
{
|
||||
int count = values.Length;
|
||||
if (count > ushort.MaxValue)
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue}");
|
||||
|
||||
WriteUInt16(Convert.ToUInt16(count));
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -156,7 +156,7 @@ namespace YooAsset
|
||||
{
|
||||
int count = values.Length;
|
||||
if (count > ushort.MaxValue)
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue}");
|
||||
|
||||
WriteUInt16(Convert.ToUInt16(count));
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -175,7 +175,7 @@ namespace YooAsset
|
||||
{
|
||||
int count = values.Length;
|
||||
if (count > ushort.MaxValue)
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue} !");
|
||||
throw new FormatException($"Write array length cannot be greater than {ushort.MaxValue}");
|
||||
|
||||
WriteUInt16(Convert.ToUInt16(count));
|
||||
for (int i = 0; i < count; i++)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace YooAsset
|
||||
{
|
||||
if (_isInitialized)
|
||||
{
|
||||
YooLogger.Warning("YooAssets is already initialized!");
|
||||
YooLogger.Warning("YooAssets is already initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace YooAsset
|
||||
{
|
||||
EnsureInitialized(packageName);
|
||||
if (ContainsPackage(packageName))
|
||||
throw new YooPackageException(packageName, $"Resource package {packageName} already existed! Cannot create duplicate packages.");
|
||||
throw new YooPackageException(packageName, $"Resource package {packageName} already existed. Cannot create duplicate packages.");
|
||||
|
||||
ResourcePackage package = new ResourcePackage(packageName);
|
||||
_packages.Add(packageName, package);
|
||||
@@ -160,7 +160,7 @@ namespace YooAsset
|
||||
|
||||
if (package.InitializeStatus != EOperationStatus.None)
|
||||
{
|
||||
YooLogger.Error($"The resource package {packageName} has not been destroyed, please call the method {nameof(ResourcePackage.DestroyPackageAsync)} to destroy!");
|
||||
YooLogger.Error($"The resource package {packageName} has not been destroyed, please call the method {nameof(ResourcePackage.DestroyPackageAsync)} to destroy.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -189,10 +189,10 @@ namespace YooAsset
|
||||
private static void EnsureInitialized(string packageName)
|
||||
{
|
||||
if (_isInitialized == false)
|
||||
throw new YooInitializeException($"YooAssets not initialized! Please call {nameof(YooAssets.Initialize)} first.");
|
||||
throw new YooInitializeException($"YooAssets not initialized. Please call {nameof(YooAssets.Initialize)} first.");
|
||||
|
||||
if (string.IsNullOrEmpty(packageName))
|
||||
throw new YooInitializeException("Package name cannot be null or empty!");
|
||||
throw new YooInitializeException("Package name cannot be null or empty.");
|
||||
}
|
||||
|
||||
#region 系统参数
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace YooAsset
|
||||
#if UNITY_EDITOR
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
// 说明:在编辑器下确保播放被停止时IO类操作被终止。
|
||||
//注意:在编辑器下确保播放被停止时IO类操作被终止。
|
||||
YooAssets.Destroy();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user