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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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