Compare commits
No commits in common. "bf1b4eabbea9a0e33b8b07c587ae50a20df1be8b" and "d20d08926b61a947e27b14dee71fdd760a056632" have entirely different histories.
bf1b4eabbe
...
d20d08926b
|
@ -2,62 +2,6 @@
|
|||
|
||||
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
|
||||
|
||||
优化了资源清单文件构建速度(极大提升构建体验)(感谢yingnierxiao同学)。
|
||||
|
|
|
@ -95,6 +95,9 @@ namespace YooAsset
|
|||
_steps = ESteps.Done;
|
||||
Status = EStatus.Succeed;
|
||||
}
|
||||
|
||||
// 注意:释放下载句柄
|
||||
_downloader.DisposeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace YooAsset
|
|||
Done,
|
||||
}
|
||||
|
||||
private bool _keepDownloadHandleLife = false;
|
||||
private DownloadHandlerAssetBundle _downloadhandler;
|
||||
private ESteps _steps = ESteps.None;
|
||||
private bool _getAssetBundle = false;
|
||||
private AssetBundle _cacheAssetBundle;
|
||||
|
||||
|
||||
public WebDownloader(BundleInfo bundleInfo, int failedTryAgain, int timeout) : base(bundleInfo, failedTryAgain, timeout)
|
||||
{
|
||||
|
@ -34,10 +34,7 @@ namespace YooAsset
|
|||
{
|
||||
if (_steps == ESteps.None)
|
||||
{
|
||||
if (param.Length > 0)
|
||||
{
|
||||
_getAssetBundle = (bool)param[0];
|
||||
}
|
||||
_keepDownloadHandleLife = (bool)param[0];
|
||||
_steps = ESteps.PrepareDownload;
|
||||
}
|
||||
}
|
||||
|
@ -138,18 +135,11 @@ namespace YooAsset
|
|||
_lastCode = 0;
|
||||
}
|
||||
|
||||
if (_getAssetBundle)
|
||||
{
|
||||
_cacheAssetBundle = _downloadhandler.assetBundle;
|
||||
if (_cacheAssetBundle == null)
|
||||
{
|
||||
_lastError = "assetBundle is null";
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
}
|
||||
|
||||
// 最终释放请求
|
||||
DisposeRequest();
|
||||
|
||||
if (_keepDownloadHandleLife == false)
|
||||
DisposeHandler();
|
||||
}
|
||||
|
||||
// 重新尝试下载
|
||||
|
@ -158,6 +148,7 @@ namespace YooAsset
|
|||
if (_failedTryAgain <= 0)
|
||||
{
|
||||
DisposeRequest();
|
||||
DisposeHandler();
|
||||
ReportError();
|
||||
_status = EStatus.Failed;
|
||||
_steps = ESteps.Done;
|
||||
|
@ -184,6 +175,7 @@ namespace YooAsset
|
|||
_lastCode = 0;
|
||||
|
||||
DisposeRequest();
|
||||
DisposeHandler();
|
||||
}
|
||||
}
|
||||
private void DisposeRequest()
|
||||
|
@ -193,11 +185,6 @@ namespace YooAsset
|
|||
_webRequest.Dispose();
|
||||
_webRequest = null;
|
||||
}
|
||||
if (_downloadhandler != null)
|
||||
{
|
||||
_downloadhandler.Dispose();
|
||||
_downloadhandler = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -205,7 +192,22 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public AssetBundle GetAssetBundle()
|
||||
{
|
||||
return _cacheAssetBundle;
|
||||
if (_downloadhandler != null)
|
||||
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()
|
||||
{
|
||||
Progress = 1f;
|
||||
_callback?.Invoke(this); //注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
_callback?.Invoke(this);
|
||||
}
|
||||
internal void SetStart()
|
||||
{
|
||||
|
|
|
@ -33,16 +33,6 @@ 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)
|
||||
{
|
||||
string remoteMainURL = _remoteServices.GetRemoteMainURL(packageBundle.FileName);
|
||||
|
@ -94,101 +84,15 @@ namespace YooAsset
|
|||
|
||||
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||
{
|
||||
List<BundleInfo> downloadList = GetDownloadListByAll(_activeManifest);
|
||||
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
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)
|
||||
{
|
||||
List<BundleInfo> downloadList = GetDownloadListByTags(_activeManifest, tags);
|
||||
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
|
||||
return operation;
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
|
||||
}
|
||||
|
||||
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
|
||||
|
@ -199,17 +103,6 @@ namespace YooAsset
|
|||
{
|
||||
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
|
||||
|
||||
#region IBundleServices接口
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.tuyoogame.yooasset",
|
||||
"displayName": "YooAsset",
|
||||
"version": "1.5.7001",
|
||||
"version": "1.5.4-preview",
|
||||
"unity": "2019.4",
|
||||
"description": "unity3d resources management system.",
|
||||
"author": {
|
||||
|
|
Loading…
Reference in New Issue