Compare commits

...

6 Commits

Author SHA1 Message Date
absences 5061439c96
Merge 02250c3352 into e76a782a80 2024-12-11 10:39:34 +08:00
何冠峰 e76a782a80 Update ResourcePackage.cs 2024-12-11 10:04:33 +08:00
何冠峰 0f7c5b2564 Update ResourcePackage.cs 2024-12-10 18:41:09 +08:00
何冠峰 fcf0f34d5a update resource manager 2024-12-10 18:00:13 +08:00
何冠峰 acf2301028 refactor : wait for sync complete 2024-12-10 16:48:08 +08:00
unknown 02250c3352 upgrade deprecated method in newer version 2024-11-12 14:40:49 +08:00
18 changed files with 88 additions and 27 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -94,6 +94,9 @@ namespace YooAsset
// 等待验证完成 // 等待验证完成
if (_steps == ESteps.CheckVerifyTempFile) if (_steps == ESteps.CheckVerifyTempFile)
{ {
if (IsWaitForAsyncComplete)
_verifyOperation.WaitForAsyncComplete();
if (_verifyOperation.IsDone == false) if (_verifyOperation.IsDone == false)
return; return;
@ -154,9 +157,6 @@ namespace YooAsset
while (true) while (true)
{ {
if (_verifyOperation != null)
_verifyOperation.WaitForAsyncComplete();
// 注意:如果是导入或解压本地文件,执行等待完毕 // 注意:如果是导入或解压本地文件,执行等待完毕
if (isReuqestLocalFile) if (isReuqestLocalFile)
{ {
@ -305,6 +305,9 @@ namespace YooAsset
// 等待验证完成 // 等待验证完成
if (_steps == ESteps.CheckVerifyTempFile) if (_steps == ESteps.CheckVerifyTempFile)
{ {
if (IsWaitForAsyncComplete)
_verifyOperation.WaitForAsyncComplete();
if (_verifyOperation.IsDone == false) if (_verifyOperation.IsDone == false)
return; return;
@ -364,9 +367,6 @@ namespace YooAsset
while (true) while (true)
{ {
if (_verifyOperation != null)
_verifyOperation.WaitForAsyncComplete();
// 注意:如果是导入或解压本地文件,执行等待完毕 // 注意:如果是导入或解压本地文件,执行等待完毕
if (isReuqestLocalFile) if (isReuqestLocalFile)
{ {

View File

@ -58,6 +58,9 @@ namespace YooAsset
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam); _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
} }
if (IsWaitForAsyncComplete)
_downloadFileOp.WaitForAsyncComplete();
DownloadProgress = _downloadFileOp.DownloadProgress; DownloadProgress = _downloadFileOp.DownloadProgress;
DownloadedBytes = _downloadFileOp.DownloadedBytes; DownloadedBytes = _downloadFileOp.DownloadedBytes;
if (_downloadFileOp.IsDone == false) if (_downloadFileOp.IsDone == false)
@ -198,9 +201,6 @@ namespace YooAsset
{ {
while (true) while (true)
{ {
if (_downloadFileOp != null)
_downloadFileOp.WaitForAsyncComplete();
if (ExecuteWhileDone()) if (ExecuteWhileDone())
{ {
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed) if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)
@ -274,6 +274,9 @@ namespace YooAsset
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam); _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
} }
if (IsWaitForAsyncComplete)
_downloadFileOp.WaitForAsyncComplete();
DownloadProgress = _downloadFileOp.DownloadProgress; DownloadProgress = _downloadFileOp.DownloadProgress;
DownloadedBytes = _downloadFileOp.DownloadedBytes; DownloadedBytes = _downloadFileOp.DownloadedBytes;
if (_downloadFileOp.IsDone == false) if (_downloadFileOp.IsDone == false)
@ -313,9 +316,6 @@ namespace YooAsset
{ {
while (true) while (true)
{ {
if (_downloadFileOp != null)
_downloadFileOp.WaitForAsyncComplete();
if (ExecuteWhileDone()) if (ExecuteWhileDone())
{ {
if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed) if (_downloadFileOp != null && _downloadFileOp.Status == EOperationStatus.Failed)

View File

@ -16,6 +16,7 @@ namespace YooAsset
DownloadProgress = 1f; DownloadProgress = 1f;
DownloadedBytes = _bundle.FileSize; DownloadedBytes = _bundle.FileSize;
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
Result = new VirtualBundle(_fileSystem, _bundle);
} }
internal override void InternalOnUpdate() internal override void InternalOnUpdate()
{ {

View File

@ -147,7 +147,7 @@ namespace YooAsset
// 当执行次数用完时 // 当执行次数用完时
_whileFrame--; _whileFrame--;
if (_whileFrame == 0) if (_whileFrame <= 0)
{ {
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = $"Operation {this.GetType().Name} failed to wait for async complete !"; Error = $"Operation {this.GetType().Name} failed to wait for async complete !";

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9ca0d0d29eb5294b9c6926c6a09e76b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@

namespace YooAsset
{
internal class VirtualBundle
{
private readonly IFileSystem _fileSystem;
private readonly PackageBundle _packageBundle;
internal VirtualBundle(IFileSystem fileSystem, PackageBundle packageBundle)
{
_fileSystem = fileSystem;
_packageBundle = packageBundle;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 822bb85f05144d842977dda341174db2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -69,6 +69,9 @@ namespace YooAsset
if (_loadBundleOp == null) if (_loadBundleOp == null)
_loadBundleOp = BundleFileInfo.LoadBundleFile(); _loadBundleOp = BundleFileInfo.LoadBundleFile();
if (IsWaitForAsyncComplete)
_loadBundleOp.WaitForAsyncComplete();
DownloadProgress = _loadBundleOp.DownloadProgress; DownloadProgress = _loadBundleOp.DownloadProgress;
DownloadedBytes = _loadBundleOp.DownloadedBytes; DownloadedBytes = _loadBundleOp.DownloadedBytes;
if (_loadBundleOp.IsDone == false) if (_loadBundleOp.IsDone == false)
@ -101,9 +104,6 @@ namespace YooAsset
{ {
while (true) while (true)
{ {
if (_loadBundleOp != null)
_loadBundleOp.WaitForAsyncComplete();
if (ExecuteWhileDone()) if (ExecuteWhileDone())
{ {
_steps = ESteps.Done; _steps = ESteps.Done;

View File

@ -36,6 +36,14 @@ namespace YooAsset
if (_steps == ESteps.CheckDepend) if (_steps == ESteps.CheckDepend)
{ {
if (IsWaitForAsyncComplete)
{
foreach (var loader in Depends)
{
loader.WaitForAsyncComplete();
}
}
foreach (var loader in Depends) foreach (var loader in Depends)
{ {
if (loader.IsDone == false) if (loader.IsDone == false)
@ -73,11 +81,6 @@ namespace YooAsset
{ {
while (true) while (true)
{ {
foreach (var loader in Depends)
{
loader.WaitForAsyncComplete();
}
if (ExecuteWhileDone()) if (ExecuteWhileDone())
{ {
_steps = ESteps.Done; _steps = ESteps.Done;

View File

@ -96,6 +96,7 @@ namespace YooAsset
{ {
if (LoadDependBundleFileOp != null) if (LoadDependBundleFileOp != null)
LoadDependBundleFileOp.WaitForAsyncComplete(); LoadDependBundleFileOp.WaitForAsyncComplete();
if (LoadBundleFileOp != null) if (LoadBundleFileOp != null)
LoadBundleFileOp.WaitForAsyncComplete(); LoadBundleFileOp.WaitForAsyncComplete();

View File

@ -176,6 +176,16 @@ namespace YooAsset
} }
#endif #endif
} }
// 检测文件系统参数
if (_playMode == EPlayMode.WebPlayMode)
{
var webPlayModeParams = parameters as WebPlayModeParameters;
var fileSystemClassName = webPlayModeParams.WebFileSystemParameters.FileSystemClass;
if (fileSystemClassName == typeof(DefaultCacheFileSystem).FullName
|| fileSystemClassName == typeof(DefaultBuildinFileSystem).FullName)
throw new Exception($"{fileSystemClassName} not support {nameof(EPlayMode.WebPlayMode)}");
}
} }
private void InitializeOperation_Completed(AsyncOperationBase op) private void InitializeOperation_Completed(AsyncOperationBase op)
{ {