mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 17:20:12 +00:00
refactor : 重构网络下载模块
This commit is contained in:
@@ -75,6 +75,9 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(_args.FileHash))
|
||||||
|
throw new YooInternalException("File hash is null or empty !");
|
||||||
|
|
||||||
// 使用 Unity 缓存
|
// 使用 Unity 缓存
|
||||||
// 说明:The file hash defining the version of the asset bundle.
|
// 说明:The file hash defining the version of the asset bundle.
|
||||||
Hash128 fileHash = Hash128.Parse(_args.FileHash);
|
Hash128 fileHash = Hash128.Parse(_args.FileHash);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace YooAsset
|
|||||||
#elif UNITY_STANDALONE_LINUX
|
#elif UNITY_STANDALONE_LINUX
|
||||||
url = StringUtility.Format("file:///root/{0}", path);
|
url = StringUtility.Format("file:///root/{0}", path);
|
||||||
#else
|
#else
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotSupportedException($"[{nameof(DownloadSystemHelper.ConvertToWWWPath)}] not implemented platform: {UnityEngine.Application.platform}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For some special cases when users have special characters in their devices, url paths can not be identified correctly.
|
// For some special cases when users have special characters in their devices, url paths can not be identified correctly.
|
||||||
|
|||||||
@@ -530,9 +530,8 @@ VirtualFileDownloader (独立实现) ──► IDownloadFileRequest
|
|||||||
|
|
||||||
提供跨平台的工具函数:
|
提供跨平台的工具函数:
|
||||||
|
|
||||||
| 成员 | 说明 |
|
| 方法 | 说明 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| `UnityWebRequestCreater` | 兼容保留的全局 UnityWebRequest 创建委托(默认文件系统不再读取,推荐改为 FileSystemParameters 注入) |
|
|
||||||
| `ConvertToWWWPath()` | 转换本地路径为 WWW 协议 URL |
|
| `ConvertToWWWPath()` | 转换本地路径为 WWW 协议 URL |
|
||||||
| `IsRequestLocalFile()` | 判断是否本地文件请求 |
|
| `IsRequestLocalFile()` | 判断是否本地文件请求 |
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ namespace YooAsset
|
|||||||
public static int GetRequestFailedCount(string packageName, string eventName)
|
public static int GetRequestFailedCount(string packageName, string eventName)
|
||||||
{
|
{
|
||||||
string key = $"{packageName}_{eventName}";
|
string key = $"{packageName}_{eventName}";
|
||||||
if (_requestFailedRecorder.ContainsKey(key) == false)
|
if (_requestFailedRecorder.TryGetValue(key, out int count))
|
||||||
_requestFailedRecorder.Add(key, 0);
|
return count;
|
||||||
return _requestFailedRecorder[key];
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user