mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-19 14:50:10 +00:00
Compare commits
21 Commits
2.2.6-prev
...
2.2.7-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
748e74e515 | ||
|
|
d1d3ad9869 | ||
|
|
f9b72a22ae | ||
|
|
766cf90a19 | ||
|
|
8a2dc86cf7 | ||
|
|
5ca54b88fa | ||
|
|
7257c8778d | ||
|
|
dc21696ae1 | ||
|
|
7f566e5388 | ||
|
|
fe352ceb84 | ||
|
|
10750a0123 | ||
|
|
f2e6da649b | ||
|
|
9737cd06dd | ||
|
|
df8cf4d9ca | ||
|
|
36b4cbb8c2 | ||
|
|
bae84f65da | ||
|
|
313ec2d100 | ||
|
|
25c5683a09 | ||
|
|
02250c3352 | ||
|
|
9e2030c83d | ||
|
|
be3fa0b688 |
@@ -2,6 +2,39 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [2.2.7-preview] - 2024-12-30
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- 重构了下载器的委托方法。
|
||||||
|
|
||||||
|
- YooAssetSettings配置文件新增Package Manifest Prefix参数。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单前缀名称(默认为空)
|
||||||
|
/// </summary>
|
||||||
|
public string PackageManifestPrefix = string.Empty;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#422) 修复了同步加载场景的NotImplementedException异常报错。
|
||||||
|
- (#418) 修复了web远程文件系统初始化不正确的问题
|
||||||
|
- (#392) 修复了引擎版本代码兼容相关的警告。
|
||||||
|
- (#332) 修复了当用户的设备中有特殊字符时,URL路径无法被正确识别的问题。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增代码字段:AsyncOperationBase.PackageName
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 重命名DownloaderOperation.OnDownloadOver()方法为DownloaderFinish()
|
||||||
|
- 重命名DownloaderOperation.OnDownloadProgress()方法为DownloadUpdate()
|
||||||
|
- 重命名DownloaderOperation.OnDownloadError()方法为DownloadError()
|
||||||
|
- 重命名DownloaderOperation.OnStartDownloadFile()方法为DownloadFileBegin()
|
||||||
|
|
||||||
## [2.2.6-preview] - 2024-12-27
|
## [2.2.6-preview] - 2024-12-27
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace YooAsset.Editor
|
|||||||
buildReport.IndependAssets = new List<ReportIndependAsset>(buildMapContext.IndependAssets);
|
buildReport.IndependAssets = new List<ReportIndependAsset>(buildMapContext.IndependAssets);
|
||||||
|
|
||||||
// 序列化文件
|
// 序列化文件
|
||||||
string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetBuildReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
BuildReport.Serialize(filePath, buildReport);
|
BuildReport.Serialize(filePath, buildReport);
|
||||||
BuildLogger.Log($"Create build report file: {filePath}");
|
BuildLogger.Log($"Create build report file: {filePath}");
|
||||||
|
|||||||
@@ -205,7 +205,9 @@ namespace YooAsset.Editor
|
|||||||
_packageListView = root.Q<ListView>("PackageListView");
|
_packageListView = root.Q<ListView>("PackageListView");
|
||||||
_packageListView.makeItem = MakePackageListViewItem;
|
_packageListView.makeItem = MakePackageListViewItem;
|
||||||
_packageListView.bindItem = BindPackageListViewItem;
|
_packageListView.bindItem = BindPackageListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_packageListView.selectionChanged += PackageListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_packageListView.onSelectionChange += PackageListView_onSelectionChange;
|
_packageListView.onSelectionChange += PackageListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_packageListView.onSelectionChanged += PackageListView_onSelectionChange;
|
_packageListView.onSelectionChanged += PackageListView_onSelectionChange;
|
||||||
@@ -250,7 +252,9 @@ namespace YooAsset.Editor
|
|||||||
_groupListView = root.Q<ListView>("GroupListView");
|
_groupListView = root.Q<ListView>("GroupListView");
|
||||||
_groupListView.makeItem = MakeGroupListViewItem;
|
_groupListView.makeItem = MakeGroupListViewItem;
|
||||||
_groupListView.bindItem = BindGroupListViewItem;
|
_groupListView.bindItem = BindGroupListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_groupListView.selectionChanged += GroupListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_groupListView.onSelectionChange += GroupListView_onSelectionChange;
|
_groupListView.onSelectionChange += GroupListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_groupListView.onSelectionChanged += GroupListView_onSelectionChange;
|
_groupListView.onSelectionChanged += GroupListView_onSelectionChange;
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ namespace YooAsset.Editor
|
|||||||
_assetListView = _root.Q<ListView>("TopListView");
|
_assetListView = _root.Q<ListView>("TopListView");
|
||||||
_assetListView.makeItem = MakeAssetListViewItem;
|
_assetListView.makeItem = MakeAssetListViewItem;
|
||||||
_assetListView.bindItem = BindAssetListViewItem;
|
_assetListView.bindItem = BindAssetListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_assetListView.selectionChanged += AssetListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
|
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
|
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ namespace YooAsset.Editor
|
|||||||
_bundleListView = _root.Q<ListView>("TopListView");
|
_bundleListView = _root.Q<ListView>("TopListView");
|
||||||
_bundleListView.makeItem = MakeBundleListViewItem;
|
_bundleListView.makeItem = MakeBundleListViewItem;
|
||||||
_bundleListView.bindItem = BindBundleListViewItem;
|
_bundleListView.bindItem = BindBundleListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_bundleListView.selectionChanged += BundleListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
|
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
|
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ namespace YooAsset.Editor
|
|||||||
_assetListView = _root.Q<ListView>("TopListView");
|
_assetListView = _root.Q<ListView>("TopListView");
|
||||||
_assetListView.makeItem = MakeAssetListViewItem;
|
_assetListView.makeItem = MakeAssetListViewItem;
|
||||||
_assetListView.bindItem = BindAssetListViewItem;
|
_assetListView.bindItem = BindAssetListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_assetListView.selectionChanged += AssetListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
|
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
|
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ namespace YooAsset.Editor
|
|||||||
_bundleListView = _root.Q<ListView>("TopListView");
|
_bundleListView = _root.Q<ListView>("TopListView");
|
||||||
_bundleListView.makeItem = MakeBundleListViewItem;
|
_bundleListView.makeItem = MakeBundleListViewItem;
|
||||||
_bundleListView.bindItem = BindBundleListViewItem;
|
_bundleListView.bindItem = BindBundleListViewItem;
|
||||||
#if UNITY_2020_1_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_bundleListView.selectionChanged += BundleListView_onSelectionChange;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
|
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
|
||||||
#else
|
#else
|
||||||
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
|
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
|
||||||
|
|||||||
@@ -25,26 +25,32 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ConvertToWWWPath(string path)
|
public static string ConvertToWWWPath(string path)
|
||||||
{
|
{
|
||||||
|
string url;
|
||||||
|
|
||||||
|
// 获取对应平台的URL地址
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
#elif UNITY_WEBGL
|
#elif UNITY_WEBGL
|
||||||
return path;
|
url = path;
|
||||||
#elif UNITY_IPHONE
|
#elif UNITY_IPHONE
|
||||||
return StringUtility.Format("file://{0}", path);
|
url = StringUtility.Format("file://{0}", path);
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
if (path.StartsWith("jar:file://"))
|
if (path.StartsWith("jar:file://"))
|
||||||
return path;
|
url = path;
|
||||||
else
|
else
|
||||||
return StringUtility.Format("jar:file://{0}", path);
|
url = StringUtility.Format("jar:file://{0}", path);
|
||||||
#elif UNITY_STANDALONE_OSX
|
#elif UNITY_STANDALONE_OSX
|
||||||
return new System.Uri(path).ToString();
|
url = new System.Uri(path).ToString();
|
||||||
#elif UNITY_STANDALONE
|
#elif UNITY_STANDALONE
|
||||||
return StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
#elif UNITY_OPENHARMONY
|
#elif UNITY_OPENHARMONY
|
||||||
return StringUtility.Format("file://{0}", path);
|
url = StringUtility.Format("file://{0}", path);
|
||||||
#else
|
#else
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// For some special cases when users have special characters in their devices, url paths can not be identified correctly.
|
||||||
|
return url.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,7 +58,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsRequestLocalFile(string url)
|
public static bool IsRequestLocalFile(string url)
|
||||||
{
|
{
|
||||||
//TODO : UNITY_STANDALONE_OSX平台目前无法确定
|
//TODO UNITY_STANDALONE_OSX平台目前无法确定
|
||||||
if (url.StartsWith("file:"))
|
if (url.StartsWith("file:"))
|
||||||
return true;
|
return true;
|
||||||
if (url.StartsWith("jar:file:"))
|
if (url.StartsWith("jar:file:"))
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (IsWaitForAsyncComplete)
|
if (IsWaitForAsyncComplete)
|
||||||
{
|
{
|
||||||
// 场景加载无法强制异步转同步
|
//注意:场景加载无法强制异步转同步
|
||||||
YooLogger.Error("The scene is loading asyn !");
|
YooLogger.Error("The scene is loading asyn !");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -104,6 +104,11 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal override void InternalWaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||||
|
InternalOnUpdate();
|
||||||
|
}
|
||||||
public override void UnSuspendLoad()
|
public override void UnSuspendLoad()
|
||||||
{
|
{
|
||||||
_suspendLoad = false;
|
_suspendLoad = false;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (IsWaitForAsyncComplete)
|
if (IsWaitForAsyncComplete)
|
||||||
{
|
{
|
||||||
// 场景加载无法强制异步转同步
|
// 注意:场景加载无法强制异步转同步
|
||||||
YooLogger.Error("The scene is loading asyn !");
|
YooLogger.Error("The scene is loading asyn !");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -110,6 +110,11 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
internal override void InternalWaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||||
|
InternalOnUpdate();
|
||||||
|
}
|
||||||
public override void UnSuspendLoad()
|
public override void UnSuspendLoad()
|
||||||
{
|
{
|
||||||
_suspendLoad = false;
|
_suspendLoad = false;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace YooAsset
|
|||||||
// 重新尝试下载
|
// 重新尝试下载
|
||||||
if (_steps == ESteps.TryAgain)
|
if (_steps == ESteps.TryAgain)
|
||||||
{
|
{
|
||||||
//TODO : 拷贝本地文件失败后不再尝试!
|
//TODO 拷贝本地文件失败后不再尝试!
|
||||||
if (_isReuqestLocalFile)
|
if (_isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
@@ -166,7 +166,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalWaitForAsyncComplete()
|
internal override void InternalWaitForAsyncComplete()
|
||||||
{
|
{
|
||||||
//TODO : 防止下载器挂起陷入无限死循环!
|
//TODO 防止下载器挂起陷入无限死循环!
|
||||||
if (_steps == ESteps.None)
|
if (_steps == ESteps.None)
|
||||||
{
|
{
|
||||||
InternalOnStart();
|
InternalOnStart();
|
||||||
@@ -174,7 +174,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//TODO : 如果是导入或解压本地文件,执行等待完毕
|
//TODO 如果是导入或解压本地文件,执行等待完毕
|
||||||
if (_isReuqestLocalFile)
|
if (_isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
InternalOnUpdate();
|
InternalOnUpdate();
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ namespace YooAsset
|
|||||||
// 重新尝试下载
|
// 重新尝试下载
|
||||||
if (_steps == ESteps.TryAgain)
|
if (_steps == ESteps.TryAgain)
|
||||||
{
|
{
|
||||||
//TODO : 拷贝本地文件失败后不再尝试!
|
//TODO 拷贝本地文件失败后不再尝试!
|
||||||
if (_isReuqestLocalFile)
|
if (_isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
@@ -188,7 +188,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalWaitForAsyncComplete()
|
internal override void InternalWaitForAsyncComplete()
|
||||||
{
|
{
|
||||||
//TODO : 防止下载器挂起陷入无限死循环!
|
//TODO 防止下载器挂起陷入无限死循环!
|
||||||
if (_steps == ESteps.None)
|
if (_steps == ESteps.None)
|
||||||
{
|
{
|
||||||
InternalOnStart();
|
InternalOnStart();
|
||||||
@@ -196,7 +196,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//TODO : 如果是导入或解压本地文件,执行等待完毕
|
//TODO 如果是导入或解压本地文件,执行等待完毕
|
||||||
if (_isReuqestLocalFile)
|
if (_isReuqestLocalFile)
|
||||||
{
|
{
|
||||||
InternalOnUpdate();
|
InternalOnUpdate();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//TODO : 等待子线程验证文件完毕,该操作会挂起主线程
|
//TODO 等待子线程验证文件完毕,该操作会挂起主线程
|
||||||
InternalOnUpdate();
|
InternalOnUpdate();
|
||||||
if (IsDone)
|
if (IsDone)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace YooAsset
|
|||||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||||
public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, bool disableUnityWebCache = false)
|
public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, bool disableUnityWebCache = false)
|
||||||
{
|
{
|
||||||
string fileSystemClass = typeof(DefaultWebServerFileSystem).FullName;
|
string fileSystemClass = typeof(DefaultWebRemoteFileSystem).FullName;
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
|
||||||
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||||
fileSystemParams.AddParameter(FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE, disableUnityWebCache);
|
fileSystemParams.AddParameter(FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE, disableUnityWebCache);
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float Progress { get; protected set; }
|
public float Progress { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属包裹名称
|
||||||
|
/// </summary>
|
||||||
|
public string PackageName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _packageName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否已经完成
|
/// 是否已经完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -98,10 +109,6 @@ namespace YooAsset
|
|||||||
throw new System.NotImplementedException(this.GetType().Name);
|
throw new System.NotImplementedException(this.GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal string GetPackageName()
|
|
||||||
{
|
|
||||||
return _packageName;
|
|
||||||
}
|
|
||||||
internal void SetPackageName(string packageName)
|
internal void SetPackageName(string packageName)
|
||||||
{
|
{
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace YooAsset
|
|||||||
// 终止临时队列里的任务
|
// 终止临时队列里的任务
|
||||||
foreach (var operation in _newList)
|
foreach (var operation in _newList)
|
||||||
{
|
{
|
||||||
if (operation.GetPackageName() == packageName)
|
if (operation.PackageName == packageName)
|
||||||
{
|
{
|
||||||
operation.SetAbort();
|
operation.SetAbort();
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ namespace YooAsset
|
|||||||
// 终止正在进行的任务
|
// 终止正在进行的任务
|
||||||
foreach (var operation in _operations)
|
foreach (var operation in _operations)
|
||||||
{
|
{
|
||||||
if (operation.GetPackageName() == packageName)
|
if (operation.PackageName == packageName)
|
||||||
{
|
{
|
||||||
operation.SetAbort();
|
operation.SetAbort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_2023_3_OR_NEWER
|
#if UNITY_2023_3_OR_NEWER
|
||||||
//TODO : 官方BUG
|
//TODO 官方BUG
|
||||||
// BUG环境:Windows平台,Unity2022.3.41f1版本,编辑器模式。
|
// BUG环境:Windows平台,Unity2022.3.41f1版本,编辑器模式。
|
||||||
// BUG描述:异步实例化Prefab预制体,有概率丢失Mono脚本里序列化的数组里某个成员!
|
// BUG描述:异步实例化Prefab预制体,有概率丢失Mono脚本里序列化的数组里某个成员!
|
||||||
//_steps = ESteps.CloneAsync;
|
//_steps = ESteps.CloneAsync;
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 下载器结束
|
||||||
|
/// </summary>
|
||||||
|
public struct DownloaderFinishData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 所属包裹名称
|
||||||
|
/// </summary>
|
||||||
|
public string PackageName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否成功
|
||||||
|
/// </summary>
|
||||||
|
public bool Succeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载器相关的更新数据
|
||||||
|
/// </summary>
|
||||||
|
public struct DownloadUpdateData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 所属包裹名称
|
||||||
|
/// </summary>
|
||||||
|
public string PackageName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载进度 (0-1f)
|
||||||
|
/// </summary>
|
||||||
|
public float Progress;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载文件总数
|
||||||
|
/// </summary>
|
||||||
|
public int TotalDownloadCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前完成的下载文件数量
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentDownloadCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载数据总大小(单位:字节)
|
||||||
|
/// </summary>
|
||||||
|
public long TotalDownloadBytes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前完成的下载数据大小(单位:字节)
|
||||||
|
/// </summary>
|
||||||
|
public long CurrentDownloadBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载器相关的错误数据
|
||||||
|
/// </summary>
|
||||||
|
public struct DownloadErrorData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 所属包裹名称
|
||||||
|
/// </summary>
|
||||||
|
public string PackageName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载失败的文件名称
|
||||||
|
/// </summary>
|
||||||
|
public string FileName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误信息
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载器相关的文件数据
|
||||||
|
/// </summary>
|
||||||
|
public struct DownloadFileData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 所属包裹名称
|
||||||
|
/// </summary>
|
||||||
|
public string PackageName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载的文件名称
|
||||||
|
/// </summary>
|
||||||
|
public string FileName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载的文件大小
|
||||||
|
/// </summary>
|
||||||
|
public long FileSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6602c4be2ef295546b7bbb328de8fb0c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -15,10 +15,27 @@ namespace YooAsset
|
|||||||
|
|
||||||
private const int MAX_LOADER_COUNT = 64;
|
private const int MAX_LOADER_COUNT = 64;
|
||||||
|
|
||||||
public delegate void OnDownloadOver(bool isSucceed);
|
#region 委托定义
|
||||||
public delegate void OnDownloadProgress(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes);
|
/// <summary>
|
||||||
public delegate void OnDownloadError(string fileName, string error);
|
/// 下载器结束
|
||||||
public delegate void OnStartDownloadFile(string fileName, long sizeBytes);
|
/// </summary>
|
||||||
|
public delegate void DownloaderFinish(DownloaderFinishData data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载进度更新
|
||||||
|
/// </summary>
|
||||||
|
public delegate void DownloadUpdate(DownloadUpdateData data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载发生错误
|
||||||
|
/// </summary>
|
||||||
|
public delegate void DownloadError(DownloadErrorData data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始下载某个文件
|
||||||
|
/// </summary>
|
||||||
|
public delegate void DownloadFileBegin(DownloadFileData data);
|
||||||
|
#endregion
|
||||||
|
|
||||||
private readonly string _packageName;
|
private readonly string _packageName;
|
||||||
private readonly int _downloadingMaxNumber;
|
private readonly int _downloadingMaxNumber;
|
||||||
@@ -67,22 +84,22 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当下载器结束(无论成功或失败)
|
/// 当下载器结束(无论成功或失败)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnDownloadOver OnDownloadOverCallback { set; get; }
|
public DownloaderFinish DownloadFinishCallback { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当下载进度发生变化
|
/// 当下载进度发生变化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnDownloadProgress OnDownloadProgressCallback { set; get; }
|
public DownloadUpdate DownloadUpdateCallback { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当某个文件下载失败
|
/// 当下载器发生错误
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnDownloadError OnDownloadErrorCallback { set; get; }
|
public DownloadError DownloadErrorCallback { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当开始下载某个文件
|
/// 当开始下载某个文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnStartDownloadFile OnStartDownloadFileCallback { set; get; }
|
public DownloadFileBegin DownloadFileBeginCallback { set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal DownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
internal DownloaderOperation(string packageName, List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
|
||||||
@@ -160,7 +177,18 @@ namespace YooAsset
|
|||||||
_lastDownloadBytes = downloadBytes;
|
_lastDownloadBytes = downloadBytes;
|
||||||
_lastDownloadCount = _cachedDownloadCount;
|
_lastDownloadCount = _cachedDownloadCount;
|
||||||
Progress = (float)_lastDownloadBytes / TotalDownloadBytes;
|
Progress = (float)_lastDownloadBytes / TotalDownloadBytes;
|
||||||
OnDownloadProgressCallback?.Invoke(TotalDownloadCount, _lastDownloadCount, TotalDownloadBytes, _lastDownloadBytes);
|
|
||||||
|
if (DownloadUpdateCallback != null)
|
||||||
|
{
|
||||||
|
var data = new DownloadUpdateData();
|
||||||
|
data.PackageName = _packageName;
|
||||||
|
data.Progress = Progress;
|
||||||
|
data.TotalDownloadCount = TotalDownloadCount;
|
||||||
|
data.CurrentDownloadCount = _lastDownloadCount;
|
||||||
|
data.TotalDownloadBytes = TotalDownloadBytes;
|
||||||
|
data.CurrentDownloadBytes = _lastDownloadBytes;
|
||||||
|
DownloadUpdateCallback.Invoke(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态创建新的下载器到最大数量限制
|
// 动态创建新的下载器到最大数量限制
|
||||||
@@ -177,7 +205,15 @@ namespace YooAsset
|
|||||||
var downloader = bundleInfo.CreateDownloader(_failedTryAgain, _timeout);
|
var downloader = bundleInfo.CreateDownloader(_failedTryAgain, _timeout);
|
||||||
_downloaders.Add(downloader);
|
_downloaders.Add(downloader);
|
||||||
_bundleInfoList.RemoveAt(index);
|
_bundleInfoList.RemoveAt(index);
|
||||||
OnStartDownloadFileCallback?.Invoke(bundleInfo.Bundle.BundleName, bundleInfo.Bundle.FileSize);
|
|
||||||
|
if (DownloadFileBeginCallback != null)
|
||||||
|
{
|
||||||
|
var data = new DownloadFileData();
|
||||||
|
data.PackageName = _packageName;
|
||||||
|
data.FileName = bundleInfo.Bundle.BundleName;
|
||||||
|
data.FileSize = bundleInfo.Bundle.FileSize;
|
||||||
|
DownloadFileBeginCallback.Invoke(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,15 +227,37 @@ namespace YooAsset
|
|||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"Failed to download file : {bundleName}";
|
Error = $"Failed to download file : {bundleName}";
|
||||||
OnDownloadErrorCallback?.Invoke(bundleName, failedDownloader.Error);
|
|
||||||
OnDownloadOverCallback?.Invoke(false);
|
if (DownloadErrorCallback != null)
|
||||||
|
{
|
||||||
|
var data = new DownloadErrorData();
|
||||||
|
data.PackageName = _packageName;
|
||||||
|
data.FileName = bundleName;
|
||||||
|
data.ErrorInfo = failedDownloader.Error;
|
||||||
|
DownloadErrorCallback.Invoke(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DownloadFinishCallback != null)
|
||||||
|
{
|
||||||
|
var data = new DownloaderFinishData();
|
||||||
|
data.PackageName = _packageName;
|
||||||
|
data.Succeed = false;
|
||||||
|
DownloadFinishCallback.Invoke(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 结算成功
|
// 结算成功
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
OnDownloadOverCallback?.Invoke(true);
|
|
||||||
|
if (DownloadFinishCallback != null)
|
||||||
|
{
|
||||||
|
var data = new DownloaderFinishData();
|
||||||
|
data.PackageName = _packageName;
|
||||||
|
data.Succeed = true;
|
||||||
|
DownloadFinishCallback.Invoke(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.InitWebRemoteFileSystem)
|
if (_steps == ESteps.InitWebRemoteFileSystem)
|
||||||
{
|
{
|
||||||
if (_initWebRemoteFileSystemOp == null)
|
if (_initWebRemoteFileSystemOp == null)
|
||||||
_initWebRemoteFileSystemOp = _impl.WebServerFileSystem.InitializeFileSystemAsync();
|
_initWebRemoteFileSystemOp = _impl.WebRemoteFileSystem.InitializeFileSystemAsync();
|
||||||
|
|
||||||
Progress = _initWebRemoteFileSystemOp.Progress;
|
Progress = _initWebRemoteFileSystemOp.Progress;
|
||||||
if (_initWebRemoteFileSystemOp.IsDone == false)
|
if (_initWebRemoteFileSystemOp.IsDone == false)
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 向网络端请求最新的资源版本
|
/// 请求最新的资源版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appendTimeTicks">在URL末尾添加时间戳</param>
|
/// <param name="appendTimeTicks">在URL末尾添加时间戳</param>
|
||||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
@@ -220,9 +220,9 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 向网络端请求并更新清单
|
/// 加载指定版本的资源清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageVersion">更新的包裹版本</param>
|
/// <param name="packageVersion">包裹版本</param>
|
||||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, int timeout = 60)
|
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, int timeout = 60)
|
||||||
{
|
{
|
||||||
@@ -240,7 +240,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预下载指定版本的包裹资源
|
/// 预下载指定版本的包裹资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageVersion">下载的包裹版本</param>
|
/// <param name="packageVersion">包裹版本</param>
|
||||||
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
/// <param name="timeout">超时时间(默认值:60秒)</param>
|
||||||
public PreDownloadContentOperation PreDownloadContentAsync(string packageVersion, int timeout = 60)
|
public PreDownloadContentOperation PreDownloadContentAsync(string packageVersion, int timeout = 60)
|
||||||
{
|
{
|
||||||
@@ -272,7 +272,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
#region 包裹信息
|
#region 包裹信息
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前激活包裹的版本信息
|
/// 获取当前加载包裹的版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageVersion()
|
public string GetPackageVersion()
|
||||||
{
|
{
|
||||||
@@ -281,7 +281,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前激活包裹的备注信息
|
/// 获取当前加载包裹的备注信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageNote()
|
public string GetPackageNote()
|
||||||
{
|
{
|
||||||
@@ -290,7 +290,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前激活包裹的详细信息
|
/// 获取当前加载包裹的详细信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PackageDetails GetPackageDetails()
|
public PackageDetails GetPackageDetails()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,15 @@ namespace YooAsset
|
|||||||
internal class YooAssetSettings : ScriptableObject
|
internal class YooAssetSettings : ScriptableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认的YooAsset文件夹名称
|
/// YooAsset文件夹名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DefaultYooFolderName = "yoo";
|
public string DefaultYooFolderName = "yoo";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单前缀名称(默认为空)
|
||||||
|
/// </summary>
|
||||||
|
public string PackageManifestPrefix = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清单文件头标记
|
/// 清单文件头标记
|
||||||
|
|||||||
@@ -36,9 +36,12 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建报告文件名
|
/// 获取构建报告文件名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetReportFileName(string packageName, string packageVersion)
|
public static string GetBuildReportFileName(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
return $"{packageName}_{packageVersion}.report";
|
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||||
|
return $"{packageName}_{packageVersion}.report";
|
||||||
|
else
|
||||||
|
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.report";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -46,7 +49,10 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetManifestBinaryFileName(string packageName, string packageVersion)
|
public static string GetManifestBinaryFileName(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
return $"{packageName}_{packageVersion}.bytes";
|
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||||
|
return $"{packageName}_{packageVersion}.bytes";
|
||||||
|
else
|
||||||
|
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.bytes";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -54,7 +60,10 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetManifestJsonFileName(string packageName, string packageVersion)
|
public static string GetManifestJsonFileName(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
return $"{packageName}_{packageVersion}.json";
|
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||||
|
return $"{packageName}_{packageVersion}.json";
|
||||||
|
else
|
||||||
|
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,7 +71,10 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetPackageHashFileName(string packageName, string packageVersion)
|
public static string GetPackageHashFileName(string packageName, string packageVersion)
|
||||||
{
|
{
|
||||||
return $"{packageName}_{packageVersion}.hash";
|
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||||
|
return $"{packageName}_{packageVersion}.hash";
|
||||||
|
else
|
||||||
|
return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.hash";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -70,7 +82,10 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetPackageVersionFileName(string packageName)
|
public static string GetPackageVersionFileName(string packageName)
|
||||||
{
|
{
|
||||||
return $"{packageName}.version";
|
if (string.IsNullOrEmpty(Setting.PackageManifestPrefix))
|
||||||
|
return $"{packageName}.version";
|
||||||
|
else
|
||||||
|
return $"{Setting.PackageManifestPrefix}_{packageName}.version";
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 路径相关
|
#region 路径相关
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73ef838ec60c36249ba05eaa3c96273e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using YooAsset.Editor;
|
||||||
|
|
||||||
|
[DisplayName("定位地址: 文件名.智能尾缀")]
|
||||||
|
public class AddressByFileNameAndExt : IAddressRule
|
||||||
|
{
|
||||||
|
public string GetAssetAddress(AddressRuleData data)
|
||||||
|
{
|
||||||
|
var ext = Path.GetExtension(data.AssetPath);
|
||||||
|
if (ext == ".asset")
|
||||||
|
{
|
||||||
|
var a = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(data.AssetPath);
|
||||||
|
if (a == null) return ".errortype";
|
||||||
|
var type = a.GetType();
|
||||||
|
var dt = Path.GetFileNameWithoutExtension(data.AssetPath);
|
||||||
|
return dt + $".{type.Name.ToLowerInvariant()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.GetFileName(data.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73aae15a0e1aec742a7e8f05755a2013
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5d7171aa14ba0e649900533bfeed0edb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using YooAsset;
|
||||||
|
|
||||||
|
public static class HandleBaseExtension
|
||||||
|
{
|
||||||
|
public static bool IsSucceed(this HandleBase thisHandle)
|
||||||
|
{
|
||||||
|
return thisHandle.IsDone && thisHandle.Status == EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 03c367406c5062c41ba3290201be20c2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5280dfac6a481ee429c769ba5688c9d2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f63bfdaa2e1fd3d48b604787fd1a8c99
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using UniFramework.Event;
|
using UniFramework.Event;
|
||||||
|
using YooAsset;
|
||||||
|
|
||||||
public class PatchEventDefine
|
public class PatchEventDefine
|
||||||
{
|
{
|
||||||
@@ -56,13 +57,13 @@ public class PatchEventDefine
|
|||||||
public long TotalDownloadSizeBytes;
|
public long TotalDownloadSizeBytes;
|
||||||
public long CurrentDownloadSizeBytes;
|
public long CurrentDownloadSizeBytes;
|
||||||
|
|
||||||
public static void SendEventMessage(int totalDownloadCount, int currentDownloadCount, long totalDownloadSizeBytes, long currentDownloadSizeBytes)
|
public static void SendEventMessage(DownloadUpdateData updateData)
|
||||||
{
|
{
|
||||||
var msg = new DownloadProgressUpdate();
|
var msg = new DownloadProgressUpdate();
|
||||||
msg.TotalDownloadCount = totalDownloadCount;
|
msg.TotalDownloadCount = updateData.TotalDownloadCount;
|
||||||
msg.CurrentDownloadCount = currentDownloadCount;
|
msg.CurrentDownloadCount = updateData.CurrentDownloadCount;
|
||||||
msg.TotalDownloadSizeBytes = totalDownloadSizeBytes;
|
msg.TotalDownloadSizeBytes = updateData.TotalDownloadBytes;
|
||||||
msg.CurrentDownloadSizeBytes = currentDownloadSizeBytes;
|
msg.CurrentDownloadSizeBytes = updateData.CurrentDownloadBytes;
|
||||||
UniEvent.SendMessage(msg);
|
UniEvent.SendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,11 +100,11 @@ public class PatchEventDefine
|
|||||||
public string FileName;
|
public string FileName;
|
||||||
public string Error;
|
public string Error;
|
||||||
|
|
||||||
public static void SendEventMessage(string fileName, string error)
|
public static void SendEventMessage(DownloadErrorData errorData)
|
||||||
{
|
{
|
||||||
var msg = new WebFileDownloadFailed();
|
var msg = new WebFileDownloadFailed();
|
||||||
msg.FileName = fileName;
|
msg.FileName = errorData.FileName;
|
||||||
msg.Error = error;
|
msg.Error = errorData.ErrorInfo;
|
||||||
UniEvent.SendMessage(msg);
|
UniEvent.SendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ public class FsmDownloadPackageFiles : IStateNode
|
|||||||
private IEnumerator BeginDownload()
|
private IEnumerator BeginDownload()
|
||||||
{
|
{
|
||||||
var downloader = (ResourceDownloaderOperation)_machine.GetBlackboardValue("Downloader");
|
var downloader = (ResourceDownloaderOperation)_machine.GetBlackboardValue("Downloader");
|
||||||
downloader.OnDownloadErrorCallback = PatchEventDefine.WebFileDownloadFailed.SendEventMessage;
|
downloader.DownloadErrorCallback = PatchEventDefine.WebFileDownloadFailed.SendEventMessage;
|
||||||
downloader.OnDownloadProgressCallback = PatchEventDefine.DownloadProgressUpdate.SendEventMessage;
|
downloader.DownloadUpdateCallback = PatchEventDefine.DownloadProgressUpdate.SendEventMessage;
|
||||||
downloader.BeginDownload();
|
downloader.BeginDownload();
|
||||||
yield return downloader;
|
yield return downloader;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "2.2.6-preview",
|
"version": "2.2.7-preview",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
Reference in New Issue
Block a user