style : Code text indent format

pull/229/head
hevinci 2023-12-21 19:40:13 +08:00
parent 727f356eea
commit 5e2d82d071
16 changed files with 146 additions and 146 deletions

View File

@ -1,54 +1,54 @@
 
namespace YooAsset namespace YooAsset
{ {
/// <summary> /// <summary>
/// 下载文件校验结果 /// 下载文件校验结果
/// </summary> /// </summary>
internal enum EVerifyResult internal enum EVerifyResult
{ {
/// <summary> /// <summary>
/// 验证异常 /// 验证异常
/// </summary> /// </summary>
Exception = -7, Exception = -7,
/// <summary> /// <summary>
/// 未找到缓存信息 /// 未找到缓存信息
/// </summary> /// </summary>
CacheNotFound = -6, CacheNotFound = -6,
/// <summary> /// <summary>
/// 信息文件不存在 /// 信息文件不存在
/// </summary> /// </summary>
InfoFileNotExisted = -5, InfoFileNotExisted = -5,
/// <summary> /// <summary>
/// 数据文件不存在 /// 数据文件不存在
/// </summary> /// </summary>
DataFileNotExisted = -4, DataFileNotExisted = -4,
/// <summary> /// <summary>
/// 文件内容不足(小于正常大小) /// 文件内容不足(小于正常大小)
/// </summary> /// </summary>
FileNotComplete = -3, FileNotComplete = -3,
/// <summary> /// <summary>
/// 文件内容溢出(超过正常大小) /// 文件内容溢出(超过正常大小)
/// </summary> /// </summary>
FileOverflow = -2, FileOverflow = -2,
/// <summary> /// <summary>
/// 文件内容不匹配 /// 文件内容不匹配
/// </summary> /// </summary>
FileCrcError = -1, FileCrcError = -1,
/// <summary> /// <summary>
/// 默认状态(校验未完成) /// 默认状态(校验未完成)
/// </summary> /// </summary>
None = 0, None = 0,
/// <summary> /// <summary>
/// 验证成功 /// 验证成功
/// </summary> /// </summary>
Succeed = 1, Succeed = 1,
} }
} }

View File

@ -11,7 +11,7 @@ namespace YooAsset
public static VerifyCacheFilesOperation CreateOperation(CacheManager cache, List<VerifyCacheFileElement> elements) public static VerifyCacheFilesOperation CreateOperation(CacheManager cache, List<VerifyCacheFileElement> elements)
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
var operation = new VerifyCacheFilesWithoutThreadOperation(cache, elements); var operation = new VerifyCacheFilesWithoutThreadOperation(cache, elements);
#else #else
var operation = new VerifyCacheFilesWithThreadOperation(cache, elements); var operation = new VerifyCacheFilesWithThreadOperation(cache, elements);
#endif #endif

View File

@ -13,7 +13,7 @@ namespace YooAsset
public static VerifyTempFileOperation CreateOperation(VerifyTempFileElement element) public static VerifyTempFileOperation CreateOperation(VerifyTempFileElement element)
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
var operation = new VerifyTempFileWithoutThreadOperation(element); var operation = new VerifyTempFileWithoutThreadOperation(element);
#else #else
var operation = new VerifyTempFileWithThreadOperation(element); var operation = new VerifyTempFileWithThreadOperation(element);
#endif #endif

View File

@ -11,17 +11,17 @@ namespace YooAsset
#if UNITY_EDITOR #if UNITY_EDITOR
return StringUtility.Format("file:///{0}", path); return StringUtility.Format("file:///{0}", path);
#elif UNITY_WEBGL #elif UNITY_WEBGL
return path; return path;
#elif UNITY_IPHONE #elif UNITY_IPHONE
return StringUtility.Format("file://{0}", path); return StringUtility.Format("file://{0}", path);
#elif UNITY_ANDROID #elif UNITY_ANDROID
return path; return path;
#elif UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_OSX
return new System.Uri(path).ToString(); return new System.Uri(path).ToString();
#elif UNITY_STANDALONE #elif UNITY_STANDALONE
return StringUtility.Format("file:///{0}", path); return StringUtility.Format("file:///{0}", path);
#else #else
return path; return path;
#endif #endif
} }
} }

View File

@ -68,9 +68,9 @@ namespace YooAsset
projectPath = PathUtility.RegularPath(projectPath); projectPath = PathUtility.RegularPath(projectPath);
return PathUtility.Combine(projectPath, YooAssetSettingsData.Setting.DefaultYooFolderName); return PathUtility.Combine(projectPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
#elif UNITY_STANDALONE #elif UNITY_STANDALONE
return PathUtility.Combine(UnityEngine.Application.dataPath, YooAssetSettingsData.Setting.DefaultYooFolderName); return PathUtility.Combine(UnityEngine.Application.dataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
#else #else
return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName); return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
#endif #endif
} }

View File

@ -25,29 +25,29 @@ namespace YooAsset
} }
} }
#else #else
private void OnEnable() private void OnEnable()
{ {
PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage); PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
} }
private void OnDisable() private void OnDisable()
{ {
PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage); PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
} }
private void OnHandleEditorMessage(MessageEventArgs args) private void OnHandleEditorMessage(MessageEventArgs args)
{ {
var command = RemoteCommand.Deserialize(args.data); var command = RemoteCommand.Deserialize(args.data);
YooLogger.Log($"On handle remote command : {command.CommandType} Param : {command.CommandParam}"); YooLogger.Log($"On handle remote command : {command.CommandType} Param : {command.CommandParam}");
if (command.CommandType == (int)ERemoteCommand.SampleOnce) if (command.CommandType == (int)ERemoteCommand.SampleOnce)
{ {
var debugReport = YooAssets.GetDebugReport(); var debugReport = YooAssets.GetDebugReport();
var data = DebugReport.Serialize(debugReport); var data = DebugReport.Serialize(debugReport);
PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgSendPlayerToEditor, data); PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgSendPlayerToEditor, data);
} }
else else
{ {
throw new NotImplementedException(command.CommandType.ToString()); throw new NotImplementedException(command.CommandType.ToString());
} }
} }
#endif #endif
} }
} }

View File

@ -100,17 +100,17 @@ namespace YooAsset
DownloaderBase newDownloader = null; DownloaderBase newDownloader = null;
YooLogger.Log($"Beginning to download bundle : {bundleInfo.Bundle.BundleName} URL : {bundleInfo.RemoteMainURL}"); YooLogger.Log($"Beginning to download bundle : {bundleInfo.Bundle.BundleName} URL : {bundleInfo.RemoteMainURL}");
#if UNITY_WEBGL #if UNITY_WEBGL
if (bundleInfo.Bundle.Buildpipeline == EDefaultBuildPipeline.RawFileBuildPipeline.ToString()) if (bundleInfo.Bundle.Buildpipeline == EDefaultBuildPipeline.RawFileBuildPipeline.ToString())
{ {
FileUtility.CreateFileDirectory(bundleInfo.CachedDataFilePath); FileUtility.CreateFileDirectory(bundleInfo.CachedDataFilePath);
System.Type requesterType = typeof(FileGeneralRequest); System.Type requesterType = typeof(FileGeneralRequest);
newDownloader = new FileDownloader(bundleInfo, requesterType, failedTryAgain, timeout); newDownloader = new FileDownloader(bundleInfo, requesterType, failedTryAgain, timeout);
} }
else else
{ {
System.Type requesterType = typeof(AssetBundleWebRequest); System.Type requesterType = typeof(AssetBundleWebRequest);
newDownloader = new WebDownloader(bundleInfo, requesterType, failedTryAgain, timeout); newDownloader = new WebDownloader(bundleInfo, requesterType, failedTryAgain, timeout);
} }
#else #else
FileUtility.CreateFileDirectory(bundleInfo.CachedDataFilePath); FileUtility.CreateFileDirectory(bundleInfo.CachedDataFilePath);
bool resumeDownload = bundleInfo.Bundle.FileSize >= _breakpointResumeFileSize; bool resumeDownload = bundleInfo.Bundle.FileSize >= _breakpointResumeFileSize;

View File

@ -75,16 +75,16 @@ namespace YooAsset
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#else #else
RequestHttpCode = _webRequest.responseCode; RequestHttpCode = _webRequest.responseCode;
if (_webRequest.isNetworkError || _webRequest.isHttpError) if (_webRequest.isNetworkError || _webRequest.isHttpError)
{ {
RequestNetError = _webRequest.error; RequestNetError = _webRequest.error;
Status = ERequestStatus.Error; Status = ERequestStatus.Error;
} }
else else
{ {
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#endif #endif
// 缓存加载的AssetBundle对象 // 缓存加载的AssetBundle对象

View File

@ -59,16 +59,16 @@ namespace YooAsset
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#else #else
RequestHttpCode = _webRequest.responseCode; RequestHttpCode = _webRequest.responseCode;
if (_webRequest.isNetworkError || _webRequest.isHttpError) if (_webRequest.isNetworkError || _webRequest.isHttpError)
{ {
RequestNetError = _webRequest.error; RequestNetError = _webRequest.error;
Status = ERequestStatus.Error; Status = ERequestStatus.Error;
} }
else else
{ {
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#endif #endif
// 最终释放下载器 // 最终释放下载器

View File

@ -48,8 +48,8 @@ namespace YooAsset
var handler = new DownloadHandlerFile(_tempFilePath, true); var handler = new DownloadHandlerFile(_tempFilePath, true);
handler.removeFileOnAbort = false; handler.removeFileOnAbort = false;
#else #else
var handler = new DownloadHandlerFileRange(tempFilePath, _bundleInfo.Bundle.FileSize, _webRequest); var handler = new DownloadHandlerFileRange(tempFilePath, _bundleInfo.Bundle.FileSize, _webRequest);
_downloadHandle = handler; _downloadHandle = handler;
#endif #endif
_webRequest.downloadHandler = handler; _webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true; _webRequest.disposeDownloadHandlerOnDispose = true;
@ -83,16 +83,16 @@ namespace YooAsset
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#else #else
RequestHttpCode = _webRequest.responseCode; RequestHttpCode = _webRequest.responseCode;
if (_webRequest.isNetworkError || _webRequest.isHttpError) if (_webRequest.isNetworkError || _webRequest.isHttpError)
{ {
RequestNetError = _webRequest.error; RequestNetError = _webRequest.error;
Status = ERequestStatus.Error; Status = ERequestStatus.Error;
} }
else else
{ {
Status = ERequestStatus.Success; Status = ERequestStatus.Success;
} }
#endif #endif
// 注意:下载断点续传文件发生特殊错误码之后删除文件 // 注意:下载断点续传文件发生特殊错误码之后删除文件

View File

@ -71,10 +71,10 @@ namespace YooAsset
#if UNITY_2020_3_OR_NEWER #if UNITY_2020_3_OR_NEWER
return _webRequest.result != UnityWebRequest.Result.Success; return _webRequest.result != UnityWebRequest.Result.Success;
#else #else
if (_webRequest.isNetworkError || _webRequest.isHttpError) if (_webRequest.isNetworkError || _webRequest.isHttpError)
return true; return true;
else else
return false; return false;
#endif #endif
} }

View File

@ -63,8 +63,8 @@ namespace YooAsset
FileLoadPath = MainBundleInfo.BuildinFilePath; FileLoadPath = MainBundleInfo.BuildinFilePath;
} }
#else #else
_steps = ESteps.LoadBundleFile; _steps = ESteps.LoadBundleFile;
FileLoadPath = MainBundleInfo.BuildinFilePath; FileLoadPath = MainBundleInfo.BuildinFilePath;
#endif #endif
} }
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache) else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)

View File

@ -45,8 +45,8 @@ namespace YooAsset
_steps = ESteps.Unpack; _steps = ESteps.Unpack;
FileLoadPath = MainBundleInfo.CachedDataFilePath; FileLoadPath = MainBundleInfo.CachedDataFilePath;
#else #else
_steps = ESteps.CheckFile; _steps = ESteps.CheckFile;
FileLoadPath = MainBundleInfo.BuildinFilePath; FileLoadPath = MainBundleInfo.BuildinFilePath;
#endif #endif
} }
else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache) else if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromCache)

View File

@ -131,7 +131,7 @@ namespace YooAsset
public void ForceUnloadAllAssets() public void ForceUnloadAllAssets()
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
throw new Exception($"WebGL not support invoke {nameof(ForceUnloadAllAssets)}"); throw new Exception($"WebGL not support invoke {nameof(ForceUnloadAllAssets)}");
#else #else
// 注意:因为场景无法异步转同步,需要等待所有场景加载完毕! // 注意:因为场景无法异步转同步,需要等待所有场景加载完毕!
foreach (var sceneHandlePair in _sceneHandles) foreach (var sceneHandlePair in _sceneHandles)
@ -429,10 +429,10 @@ namespace YooAsset
else else
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
if (bundleInfo.Bundle.Buildpipeline== EDefaultBuildPipeline.RawFileBuildPipeline.ToString()) if (bundleInfo.Bundle.Buildpipeline== EDefaultBuildPipeline.RawFileBuildPipeline.ToString())
loader = new RawBundleWebLoader(this, bundleInfo); loader = new RawBundleWebLoader(this, bundleInfo);
else else
loader = new AssetBundleWebLoader(this, bundleInfo); loader = new AssetBundleWebLoader(this, bundleInfo);
#else #else
if (bundleInfo.Bundle.Buildpipeline == EDefaultBuildPipeline.RawFileBuildPipeline.ToString()) if (bundleInfo.Bundle.Buildpipeline == EDefaultBuildPipeline.RawFileBuildPipeline.ToString())
loader = new RawBundleFileLoader(this, bundleInfo); loader = new RawBundleFileLoader(this, bundleInfo);

View File

@ -42,12 +42,12 @@ namespace YooAsset
#else #else
namespace YooAsset namespace YooAsset
{ {
public static class EditorSimulateModeHelper public static class EditorSimulateModeHelper
{ {
/// <summary> /// <summary>
/// 编辑器下模拟构建清单 /// 编辑器下模拟构建清单
/// </summary> /// </summary>
public static string SimulateBuild(string buildPipelineName, string packageName) { throw new System.Exception("Only support in unity editor !"); } public static string SimulateBuild(string buildPipelineName, string packageName) { throw new System.Exception("Only support in unity editor !"); }
} }
} }
#endif #endif

View File

@ -214,8 +214,8 @@ namespace YooAsset
throw new Exception($"{nameof(ResourcePackage)} create parameters is null."); throw new Exception($"{nameof(ResourcePackage)} create parameters is null.");
#if !UNITY_EDITOR #if !UNITY_EDITOR
if (parameters is EditorSimulateModeParameters) if (parameters is EditorSimulateModeParameters)
throw new Exception($"Editor simulate mode only support unity editor."); throw new Exception($"Editor simulate mode only support unity editor.");
#endif #endif
if (parameters is EditorSimulateModeParameters) if (parameters is EditorSimulateModeParameters)
@ -255,10 +255,10 @@ namespace YooAsset
if (_playMode != EPlayMode.EditorSimulateMode) if (_playMode != EPlayMode.EditorSimulateMode)
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
if (_playMode != EPlayMode.WebPlayMode) if (_playMode != EPlayMode.WebPlayMode)
{ {
throw new Exception($"{_playMode} can not support WebGL plateform ! Please use {nameof(EPlayMode.WebPlayMode)}"); throw new Exception($"{_playMode} can not support WebGL plateform ! Please use {nameof(EPlayMode.WebPlayMode)}");
} }
#else #else
if (_playMode == EPlayMode.WebPlayMode) if (_playMode == EPlayMode.WebPlayMode)
{ {