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