Compare commits
10 Commits
d20d08926b
...
bf1b4eabbe
Author | SHA1 | Date |
---|---|---|
QiJing | bf1b4eabbe | |
QiJing | aee489d5d6 | |
hevinci | 4f25791b77 | |
hevinci | 81ae4ea377 | |
hevinci | 00f973b66f | |
hevinci | a366b08699 | |
hevinci | 6c4aaf8c80 | |
hevinci | c649068f6b | |
hevinci | bd3f57ff0c | |
hevinci | 8dde329ff4 |
|
@ -2,6 +2,62 @@
|
||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [1.5.7] - 2023-10-07
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- WebGL平台支持创建下载器。
|
||||||
|
|
||||||
|
## [1.5.6-preview] - 2023-09-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#172) 修复包裹初始化后,package的状态不正确的问题。
|
||||||
|
|
||||||
|
## [1.5.5-preview] - 2023-09-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#96) 修复了异步操作任务的完成回调在业务层触发异常时无法正常完成的问题。
|
||||||
|
- (#156) 修复了多个Package存在时,服务器请求地址请求顺序不对的问题。
|
||||||
|
- (#163) 修复了Unity2019版本编译报错的问题。
|
||||||
|
- (#167) 修复了初始化时每次都会提示文件验证失败日志。
|
||||||
|
- (#171) 修复了IsNeedDownloadFromRemote里缺少判断依赖的资源是否下载 。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 资源收集器里增加了AddressDisable规则。
|
||||||
|
|
||||||
|
- 资源收集器里FilterRuleData结构体增加了多个备选字段。
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public struct FilterRuleData
|
||||||
|
{
|
||||||
|
public string AssetPath;
|
||||||
|
public string CollectPath;
|
||||||
|
public string GroupName;
|
||||||
|
public string UserData;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 可以设置自定义参数DefaultYooFolderName。
|
||||||
|
|
||||||
|
- 资源配置界面的分组不激活时,不再进行配置检测。
|
||||||
|
|
||||||
|
- SBP构建管线增加新构建参数用于修复图集资源冗余问题。
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public class SBPBuildParameters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 修复图集资源冗余问题
|
||||||
|
/// </summary>
|
||||||
|
public bool FixSpriteAtlasRedundancy = false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## [1.5.4-preview] - 2023-08-25
|
## [1.5.4-preview] - 2023-08-25
|
||||||
|
|
||||||
优化了资源清单文件构建速度(极大提升构建体验)(感谢yingnierxiao同学)。
|
优化了资源清单文件构建速度(极大提升构建体验)(感谢yingnierxiao同学)。
|
||||||
|
|
|
@ -95,9 +95,6 @@ namespace YooAsset
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EStatus.Succeed;
|
Status = EStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:释放下载句柄
|
|
||||||
_downloader.DisposeHandler();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@ namespace YooAsset
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _keepDownloadHandleLife = false;
|
|
||||||
private DownloadHandlerAssetBundle _downloadhandler;
|
private DownloadHandlerAssetBundle _downloadhandler;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
private bool _getAssetBundle = false;
|
||||||
|
private AssetBundle _cacheAssetBundle;
|
||||||
|
|
||||||
public WebDownloader(BundleInfo bundleInfo, int failedTryAgain, int timeout) : base(bundleInfo, failedTryAgain, timeout)
|
public WebDownloader(BundleInfo bundleInfo, int failedTryAgain, int timeout) : base(bundleInfo, failedTryAgain, timeout)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,10 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None)
|
if (_steps == ESteps.None)
|
||||||
{
|
{
|
||||||
_keepDownloadHandleLife = (bool)param[0];
|
if (param.Length > 0)
|
||||||
|
{
|
||||||
|
_getAssetBundle = (bool)param[0];
|
||||||
|
}
|
||||||
_steps = ESteps.PrepareDownload;
|
_steps = ESteps.PrepareDownload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,11 +138,18 @@ namespace YooAsset
|
||||||
_lastCode = 0;
|
_lastCode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_getAssetBundle)
|
||||||
|
{
|
||||||
|
_cacheAssetBundle = _downloadhandler.assetBundle;
|
||||||
|
if (_cacheAssetBundle == null)
|
||||||
|
{
|
||||||
|
_lastError = "assetBundle is null";
|
||||||
|
_steps = ESteps.TryAgain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 最终释放请求
|
// 最终释放请求
|
||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
|
|
||||||
if (_keepDownloadHandleLife == false)
|
|
||||||
DisposeHandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新尝试下载
|
// 重新尝试下载
|
||||||
|
@ -148,7 +158,6 @@ namespace YooAsset
|
||||||
if (_failedTryAgain <= 0)
|
if (_failedTryAgain <= 0)
|
||||||
{
|
{
|
||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
DisposeHandler();
|
|
||||||
ReportError();
|
ReportError();
|
||||||
_status = EStatus.Failed;
|
_status = EStatus.Failed;
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
|
@ -175,7 +184,6 @@ namespace YooAsset
|
||||||
_lastCode = 0;
|
_lastCode = 0;
|
||||||
|
|
||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
DisposeHandler();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DisposeRequest()
|
private void DisposeRequest()
|
||||||
|
@ -185,6 +193,11 @@ namespace YooAsset
|
||||||
_webRequest.Dispose();
|
_webRequest.Dispose();
|
||||||
_webRequest = null;
|
_webRequest = null;
|
||||||
}
|
}
|
||||||
|
if (_downloadhandler != null)
|
||||||
|
{
|
||||||
|
_downloadhandler.Dispose();
|
||||||
|
_downloadhandler = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -192,22 +205,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AssetBundle GetAssetBundle()
|
public AssetBundle GetAssetBundle()
|
||||||
{
|
{
|
||||||
if (_downloadhandler != null)
|
return _cacheAssetBundle;
|
||||||
return _downloadhandler.assetBundle;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放下载句柄
|
|
||||||
/// </summary>
|
|
||||||
public void DisposeHandler()
|
|
||||||
{
|
|
||||||
if (_downloadhandler != null)
|
|
||||||
{
|
|
||||||
_downloadhandler.Dispose();
|
|
||||||
_downloadhandler = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -77,9 +77,9 @@ namespace YooAsset
|
||||||
internal void SetFinish()
|
internal void SetFinish()
|
||||||
{
|
{
|
||||||
Progress = 1f;
|
Progress = 1f;
|
||||||
|
_callback?.Invoke(this); //注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||||
if (_taskCompletionSource != null)
|
if (_taskCompletionSource != null)
|
||||||
_taskCompletionSource.TrySetResult(null);
|
_taskCompletionSource.TrySetResult(null);
|
||||||
_callback?.Invoke(this);
|
|
||||||
}
|
}
|
||||||
internal void SetStart()
|
internal void SetStart()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,16 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载相关
|
// 下载相关
|
||||||
|
private List<BundleInfo> ConvertToDownloadList(List<PackageBundle> downloadList)
|
||||||
|
{
|
||||||
|
List<BundleInfo> result = new List<BundleInfo>(downloadList.Count);
|
||||||
|
foreach (var packageBundle in downloadList)
|
||||||
|
{
|
||||||
|
var bundleInfo = ConvertToDownloadInfo(packageBundle);
|
||||||
|
result.Add(bundleInfo);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
private BundleInfo ConvertToDownloadInfo(PackageBundle packageBundle)
|
private BundleInfo ConvertToDownloadInfo(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
string remoteMainURL = _remoteServices.GetRemoteMainURL(packageBundle.FileName);
|
string remoteMainURL = _remoteServices.GetRemoteMainURL(packageBundle.FileName);
|
||||||
|
@ -84,15 +94,101 @@ namespace YooAsset
|
||||||
|
|
||||||
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||||
{
|
{
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
List<BundleInfo> downloadList = GetDownloadListByAll(_activeManifest);
|
||||||
|
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||||
|
return operation;
|
||||||
}
|
}
|
||||||
|
public List<BundleInfo> GetDownloadListByAll(PackageManifest manifest)
|
||||||
|
{
|
||||||
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
|
{
|
||||||
|
// 忽略APP资源
|
||||||
|
if (IsBuildinPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
downloadList.Add(packageBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertToDownloadList(downloadList);
|
||||||
|
}
|
||||||
|
|
||||||
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||||
{
|
{
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
List<BundleInfo> downloadList = GetDownloadListByTags(_activeManifest, tags);
|
||||||
|
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||||
|
return operation;
|
||||||
}
|
}
|
||||||
|
public List<BundleInfo> GetDownloadListByTags(PackageManifest manifest, string[] tags)
|
||||||
|
{
|
||||||
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
|
{
|
||||||
|
// 忽略APP资源
|
||||||
|
if (IsBuildinPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 如果未带任何标记,则统一下载
|
||||||
|
if (packageBundle.HasAnyTags() == false)
|
||||||
|
{
|
||||||
|
downloadList.Add(packageBundle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 查询DLC资源
|
||||||
|
if (packageBundle.HasTag(tags))
|
||||||
|
{
|
||||||
|
downloadList.Add(packageBundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertToDownloadList(downloadList);
|
||||||
|
}
|
||||||
|
|
||||||
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||||
{
|
{
|
||||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
List<BundleInfo> downloadList = GetDownloadListByPaths(_activeManifest, assetInfos);
|
||||||
|
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public List<BundleInfo> GetDownloadListByPaths(PackageManifest manifest, AssetInfo[] assetInfos)
|
||||||
|
{
|
||||||
|
// 获取资源对象的资源包和所有依赖资源包
|
||||||
|
List<PackageBundle> checkList = new List<PackageBundle>();
|
||||||
|
foreach (var assetInfo in assetInfos)
|
||||||
|
{
|
||||||
|
if (assetInfo.IsInvalid)
|
||||||
|
{
|
||||||
|
YooLogger.Warning(assetInfo.Error);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
PackageBundle mainBundle = manifest.GetMainPackageBundle(assetInfo.AssetPath);
|
||||||
|
if (checkList.Contains(mainBundle) == false)
|
||||||
|
checkList.Add(mainBundle);
|
||||||
|
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
PackageBundle[] dependBundles = manifest.GetAllDependencies(assetInfo.AssetPath);
|
||||||
|
foreach (var dependBundle in dependBundles)
|
||||||
|
{
|
||||||
|
if (checkList.Contains(dependBundle) == false)
|
||||||
|
checkList.Add(dependBundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
|
||||||
|
foreach (var packageBundle in checkList)
|
||||||
|
{
|
||||||
|
// 忽略APP资源
|
||||||
|
if (IsBuildinPackageBundle(packageBundle))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
downloadList.Add(packageBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConvertToDownloadList(downloadList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
|
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
|
||||||
|
@ -103,6 +199,17 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
|
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PackageBundle> GetCachedTagsRawFiles(string[] tags)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PackageBundle> GetNeedDownloadTagsRawFiles(string[] tags)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "1.5.4-preview",
|
"version": "1.5.7001",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
Loading…
Reference in New Issue