mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-15 12:10:09 +00:00
Compare commits
11 Commits
2.0.0-prev
...
2.0.1-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1313e05d5d | ||
|
|
8817b35517 | ||
|
|
cfe8a77dd5 | ||
|
|
a874d17798 | ||
|
|
5d9ef12577 | ||
|
|
b3a135e1a2 | ||
|
|
a25d03f073 | ||
|
|
589c0d3ce5 | ||
|
|
8457705807 | ||
|
|
ce7aefb744 | ||
|
|
499d7766db |
@@ -2,6 +2,27 @@
|
||||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [2.0.1-preview] - 2023-10-11
|
||||
|
||||
### Fixed
|
||||
|
||||
- (#175) Fixed a bug where the url path of mac platform contains spaces, which would cause the request error.
|
||||
- (#177) Fixed the inability to load main asset object after loading the sub asset.
|
||||
- (#178) Fixed the error when initializing resource package that prompted not initialized.
|
||||
- (#179) Fixed issue with SBP build pipeline packaging reporting errors.
|
||||
|
||||
### Added
|
||||
|
||||
- Resource downloader add combine function.
|
||||
|
||||
```c#
|
||||
/// <summary>
|
||||
/// 合并其它下载器
|
||||
/// </summary>
|
||||
/// <param name="downloader">合并的下载器</param>
|
||||
public void Combine(DownloaderOperation downloader);
|
||||
```
|
||||
|
||||
## [2.0.0-preview] - 2023-10-07
|
||||
|
||||
This is the preview version.
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace YooAsset.Editor
|
||||
public abstract class TaskCreateManifest
|
||||
{
|
||||
private readonly Dictionary<string, int> _cachedBundleID = new Dictionary<string, int>(10000);
|
||||
private readonly Dictionary<int, HashSet<string>> _cacheBundleTags = new Dictionary<int, HashSet<string>>(10000);
|
||||
|
||||
/// <summary>
|
||||
/// 创建补丁清单文件到输出目录
|
||||
@@ -165,36 +166,43 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
private void ProcessBundleTags(PackageManifest manifest)
|
||||
{
|
||||
Dictionary<int, HashSet<string>> cacheBundleTags = new Dictionary<int, HashSet<string>>(10000);
|
||||
|
||||
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||
foreach (var packageAsset in manifest.AssetList)
|
||||
{
|
||||
// 主资源包
|
||||
var assetTags = packageAsset.AssetTags;
|
||||
int bundleID = packageAsset.BundleID;
|
||||
CacheBundleTags(cacheBundleTags, bundleID, packageAsset.AssetTags);
|
||||
CacheBundleTags(bundleID, assetTags);
|
||||
|
||||
// 依赖资源包
|
||||
var packageBundle = manifest.BundleList[bundleID];
|
||||
foreach (var dependBundleID in packageBundle.DependIDs)
|
||||
{
|
||||
CacheBundleTags(cacheBundleTags, dependBundleID, packageAsset.AssetTags);
|
||||
CacheBundleTags(dependBundleID, assetTags);
|
||||
}
|
||||
}
|
||||
|
||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||
{
|
||||
manifest.BundleList[index].Tags = cacheBundleTags[index].ToArray();
|
||||
var packageBundle = manifest.BundleList[index];
|
||||
if (_cacheBundleTags.ContainsKey(index))
|
||||
{
|
||||
packageBundle.Tags = _cacheBundleTags[index].ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:SBP构建管线会自动剔除一些冗余资源的引用关系,导致游离资源包没有被任何主资源包引用。
|
||||
UnityEngine.Debug.LogWarning($"发现游离的资源包 {index} ! {packageBundle.BundleName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void CacheBundleTags(Dictionary<int, HashSet<string>> cacheBundleTags, int bundleID, string[] assetTags)
|
||||
private void CacheBundleTags(int bundleID, string[] assetTags)
|
||||
{
|
||||
if (cacheBundleTags.ContainsKey(bundleID) == false)
|
||||
cacheBundleTags.Add(bundleID, new HashSet<string>());
|
||||
if (_cacheBundleTags.ContainsKey(bundleID) == false)
|
||||
_cacheBundleTags.Add(bundleID, new HashSet<string>());
|
||||
|
||||
foreach (var assetTag in assetTags)
|
||||
{
|
||||
if (cacheBundleTags[bundleID].Contains(assetTag) == false)
|
||||
cacheBundleTags[bundleID].Add(assetTag);
|
||||
if (_cacheBundleTags[bundleID].Contains(assetTag) == false)
|
||||
_cacheBundleTags[bundleID].Add(assetTag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace YooAsset.Editor
|
||||
// 4. 移除所有零引用的依赖资源
|
||||
foreach (var removeValue in removeList)
|
||||
{
|
||||
BuildLogger.Log($"发现未被依赖的资源并自动移除 : {removeValue.AssetPath}");
|
||||
BuildLogger.Warning($"发现未被依赖的资源并自动移除 : {removeValue.AssetPath}");
|
||||
allCollectAssetInfos.Remove(removeValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
{
|
||||
_cache = cache;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.GetAllCacheFiles;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace YooAsset
|
||||
_package = package;
|
||||
_cache = cache;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.GetUnusedCacheFiles;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_cache = cache;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.Prepare;
|
||||
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace YooAsset
|
||||
_cache = cache;
|
||||
_waitingList = elements;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.InitVerify;
|
||||
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -175,12 +175,12 @@ namespace YooAsset
|
||||
_cache = cache;
|
||||
_waitingList = elements;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.InitVerify;
|
||||
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace YooAsset
|
||||
{
|
||||
_element = element;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.VerifyFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -110,11 +110,11 @@ namespace YooAsset
|
||||
{
|
||||
_element = element;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.VerifyFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_cache = cache;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.FindCacheFiles;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -10,13 +10,17 @@ namespace YooAsset
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return StringUtility.Format("file:///{0}", path);
|
||||
#elif UNITY_WEBGL
|
||||
return path;
|
||||
#elif UNITY_IPHONE
|
||||
return StringUtility.Format("file://{0}", path);
|
||||
#elif UNITY_ANDROID
|
||||
return path;
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
return new System.Uri(path).ToString();
|
||||
#elif UNITY_STANDALONE
|
||||
return StringUtility.Format("file:///{0}", path);
|
||||
#elif UNITY_WEBGL
|
||||
#else
|
||||
return path;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace YooAsset
|
||||
if (_steps == ESteps.WaitingVerifyTempFile)
|
||||
{
|
||||
if (WaitForAsyncComplete)
|
||||
_verifyFileOp.Update();
|
||||
_verifyFileOp.InternalOnUpdate();
|
||||
|
||||
if (_verifyFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -76,21 +76,18 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract void Start();
|
||||
internal abstract void Update();
|
||||
internal abstract void InternalOnStart();
|
||||
internal abstract void InternalOnUpdate();
|
||||
internal virtual void InternalOnAbort() { }
|
||||
|
||||
internal void SetPackageName(string packageName)
|
||||
{
|
||||
PackageName = packageName;
|
||||
}
|
||||
internal void SetAbort()
|
||||
internal void SetStart()
|
||||
{
|
||||
if (IsDone == false)
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "user abort";
|
||||
YooLogger.Warning($"Async operaiton has been abort : {this.GetType().Name}");
|
||||
}
|
||||
Status = EOperationStatus.Processing;
|
||||
InternalOnStart();
|
||||
}
|
||||
internal void SetFinish()
|
||||
{
|
||||
@@ -99,9 +96,15 @@ namespace YooAsset
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
}
|
||||
internal void SetStart()
|
||||
internal void SetAbort()
|
||||
{
|
||||
Status = EOperationStatus.Processing;
|
||||
if (IsDone == false)
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "user abort";
|
||||
YooLogger.Warning($"Async operaiton has been abort : {this.GetType().Name}");
|
||||
InternalOnAbort();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,14 +3,18 @@ namespace YooAsset
|
||||
{
|
||||
public abstract class GameAsyncOperation : AsyncOperationBase
|
||||
{
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
OnUpdate();
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
{
|
||||
OnAbort();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作开始
|
||||
@@ -22,6 +26,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
protected abstract void OnUpdate();
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作终止
|
||||
/// </summary>
|
||||
protected abstract void OnAbort();
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作系统是否繁忙
|
||||
/// </summary>
|
||||
|
||||
@@ -59,16 +59,15 @@ namespace YooAsset
|
||||
break;
|
||||
|
||||
var operation = _operations[i];
|
||||
if (operation.IsDone == false)
|
||||
operation.InternalOnUpdate();
|
||||
|
||||
if (operation.IsDone)
|
||||
{
|
||||
// 注意:如果业务端发生异常,保证异步操作提前移除。
|
||||
_operations.RemoveAt(i);
|
||||
operation.SetFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
operation.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +115,6 @@ namespace YooAsset
|
||||
_newList.Add(operation);
|
||||
operation.SetPackageName(packageName);
|
||||
operation.SetStart();
|
||||
operation.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,11 @@ namespace YooAsset
|
||||
_parent = parent;
|
||||
_worldPositionStays = worldPositionStays;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.Clone;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -93,7 +93,7 @@ namespace YooAsset
|
||||
if (_steps == ESteps.Done)
|
||||
return;
|
||||
_handle.WaitForAsyncComplete();
|
||||
Update();
|
||||
InternalOnUpdate();
|
||||
}
|
||||
|
||||
internal static GameObject InstantiateInternal(UnityEngine.Object assetObject, bool setPositionAndRotation, Vector3 position, Quaternion rotation, Transform parent, bool worldPositionStays)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace YooAsset
|
||||
_flag = EFlag.Normal;
|
||||
_scene = scene;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
if (_flag == EFlag.Normal)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace YooAsset
|
||||
throw new System.NotImplementedException(_flag.ToString());
|
||||
}
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace YooAsset
|
||||
return completedProvider.CreateHandle<AssetHandle>();
|
||||
}
|
||||
|
||||
string providerGUID = assetInfo.GUID;
|
||||
string providerGUID = nameof(LoadAssetAsync) + assetInfo.GUID;
|
||||
ProviderBase provider = TryGetProvider(providerGUID);
|
||||
if (provider == null)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ namespace YooAsset
|
||||
return completedProvider.CreateHandle<SubAssetsHandle>();
|
||||
}
|
||||
|
||||
string providerGUID = assetInfo.GUID;
|
||||
string providerGUID = nameof(LoadSubAssetsAsync) + assetInfo.GUID;
|
||||
ProviderBase provider = TryGetProvider(providerGUID);
|
||||
if (provider == null)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ namespace YooAsset
|
||||
return completedProvider.CreateHandle<AllAssetsHandle>();
|
||||
}
|
||||
|
||||
string providerGUID = assetInfo.GUID;
|
||||
string providerGUID = nameof(LoadAllAssetsAsync) + assetInfo.GUID;
|
||||
ProviderBase provider = TryGetProvider(providerGUID);
|
||||
if (provider == null)
|
||||
{
|
||||
@@ -286,7 +286,7 @@ namespace YooAsset
|
||||
return completedProvider.CreateHandle<RawFileHandle>();
|
||||
}
|
||||
|
||||
string providerGUID = assetInfo.GUID;
|
||||
string providerGUID = nameof(LoadRawFileAsync) + assetInfo.GUID;
|
||||
ProviderBase provider = TryGetProvider(providerGUID);
|
||||
if (provider == null)
|
||||
{
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace YooAsset
|
||||
return _providerGUID;
|
||||
|
||||
if (AssetType == null)
|
||||
_providerGUID = $"{AssetPath}[null]";
|
||||
_providerGUID = $"[{AssetPath}][null]";
|
||||
else
|
||||
_providerGUID = $"{AssetPath}[{AssetType.Name}]";
|
||||
_providerGUID = $"[{AssetPath}][{AssetType.Name}]";
|
||||
return _providerGUID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,21 +95,15 @@ namespace YooAsset
|
||||
_failedTryAgain = failedTryAgain;
|
||||
_timeout = timeout;
|
||||
|
||||
if (downloadList != null)
|
||||
{
|
||||
TotalDownloadCount = downloadList.Count;
|
||||
foreach (var packageBundle in downloadList)
|
||||
{
|
||||
TotalDownloadBytes += packageBundle.Bundle.FileSize;
|
||||
}
|
||||
}
|
||||
// 统计下载信息
|
||||
CalculatDownloaderInfo();
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
YooLogger.Log($"Begine to download : {TotalDownloadCount} files and {TotalDownloadBytes} bytes");
|
||||
_steps = ESteps.Check;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -210,7 +204,58 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
private void CalculatDownloaderInfo()
|
||||
{
|
||||
if (_bundleInfoList != null)
|
||||
{
|
||||
TotalDownloadCount = _bundleInfoList.Count;
|
||||
foreach (var packageBundle in _bundleInfoList)
|
||||
{
|
||||
TotalDownloadBytes += packageBundle.Bundle.FileSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并其它下载器
|
||||
/// </summary>
|
||||
/// <param name="downloader">合并的下载器</param>
|
||||
public void Combine(DownloaderOperation downloader)
|
||||
{
|
||||
if (_packageName != downloader._packageName)
|
||||
{
|
||||
YooLogger.Error("The downloaders have different resource packages !");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Status != EOperationStatus.None)
|
||||
{
|
||||
YooLogger.Error("The downloader is running, can not combine with other downloader !");
|
||||
return;
|
||||
}
|
||||
|
||||
HashSet<string> temper = new HashSet<string>();
|
||||
foreach (var bundleInfo in _bundleInfoList)
|
||||
{
|
||||
if (temper.Contains(bundleInfo.CachedDataFilePath) == false)
|
||||
{
|
||||
temper.Add(bundleInfo.CachedDataFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
// 合并下载列表
|
||||
foreach (var bundleInfo in downloader._bundleInfoList)
|
||||
{
|
||||
if (temper.Contains(bundleInfo.CachedDataFilePath) == false)
|
||||
{
|
||||
_bundleInfoList.Add(bundleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 重新统计下载信息
|
||||
CalculatDownloaderInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始下载
|
||||
/// </summary>
|
||||
|
||||
@@ -35,11 +35,11 @@ namespace YooAsset
|
||||
_impl = impl;
|
||||
_simulateManifestFilePath = simulateManifestFilePath;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadEditorManifest;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.LoadEditorManifest)
|
||||
{
|
||||
@@ -93,11 +93,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.QueryBuildinPackageVersion;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -201,11 +201,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.CheckAppFootPrint;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -382,11 +382,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.QueryWebPackageVersion;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace YooAsset
|
||||
{
|
||||
_buffer = new BufferReader(binaryData);
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.DeserializeFileHeader;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -27,12 +27,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = RequestHelper.GetRequestFailedCount(_persistent.PackageName, nameof(DownloadManifestOperation));
|
||||
_steps = ESteps.DownloadPackageHashFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_buildinPackageVersion = buildinPackageVersion;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadBuildinManifest;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.QueryCachePackageHash;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace YooAsset
|
||||
_packageName = packageName;
|
||||
_manifestFilePath = manifestFilePath;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadEditorManifest;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = RequestHelper.GetRequestFailedCount(_packageName, nameof(LoadRemoteManifestOperation));
|
||||
_steps = ESteps.DownloadPackageHashFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace YooAsset
|
||||
{
|
||||
_persistent = persistent;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadBuildinPackageVersionFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadCachePackageHashFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace YooAsset
|
||||
{
|
||||
_persistent = persistent;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.LoadCachePackageVersionFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = RequestHelper.GetRequestFailedCount(_packageName, nameof(QueryRemotePackageHashOperation));
|
||||
_steps = ESteps.DownloadPackageHash;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_requestCount = RequestHelper.GetRequestFailedCount(_packageName, nameof(QueryRemotePackageVersionOperation));
|
||||
_steps = ESteps.DownloadPackageVersion;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace YooAsset
|
||||
_persistent = persistent;
|
||||
_buildinPackageVersion = buildinPackageVersion;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.UnpackManifestHashFile;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -59,11 +59,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -154,11 +154,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.CheckActiveManifest;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -331,11 +331,11 @@ namespace YooAsset
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
public EditorPlayModeUpdatePackageManifestOperation()
|
||||
{
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -40,11 +40,11 @@ namespace YooAsset
|
||||
public OfflinePlayModeUpdatePackageManifestOperation()
|
||||
{
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -84,11 +84,11 @@ namespace YooAsset
|
||||
_autoSaveVersion = autoSaveVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.CheckParams;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -229,11 +229,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.CheckParams;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
internal sealed class EditorPlayModeUpdatePackageVersionOperation : UpdatePackageVersionOperation
|
||||
{
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,11 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
internal sealed class OfflinePlayModeUpdatePackageVersionOperation : UpdatePackageVersionOperation
|
||||
{
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -67,11 +67,11 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.QueryRemotePackageVersion;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -127,11 +127,11 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void Start()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
_steps = ESteps.QueryRemotePackageVersion;
|
||||
}
|
||||
internal override void Update()
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -1019,7 +1019,18 @@ namespace YooAsset
|
||||
|
||||
#region 资源解压
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// 创建内置资源解压器,用于解压当前资源版本所有的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
/// <param name="failedTryAgain">解压失败的重试次数</param>
|
||||
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
||||
{
|
||||
DebugCheckInitialize();
|
||||
return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器,用于解压指定的资源标签关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tag">资源标签</param>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
@@ -1031,7 +1042,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// 创建内置资源解压器,用于解压指定的资源标签列表关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tags">资源标签列表</param>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
@@ -1041,17 +1052,6 @@ namespace YooAsset
|
||||
DebugCheckInitialize();
|
||||
return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// </summary>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
/// <param name="failedTryAgain">解压失败的重试次数</param>
|
||||
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
||||
{
|
||||
DebugCheckInitialize();
|
||||
return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain, int.MaxValue);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 资源导入
|
||||
|
||||
@@ -69,6 +69,38 @@ namespace YooAsset
|
||||
return _defaultPackage.GetAssetInfo(location);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源信息
|
||||
/// </summary>
|
||||
/// <param name="location">资源的定位地址</param>
|
||||
/// <param name="type">资源类型</param>
|
||||
public static AssetInfo GetAssetInfo(string location, System.Type type)
|
||||
{
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.GetAssetInfo(location, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源信息
|
||||
/// </summary>
|
||||
/// <param name="assetGUID">资源GUID</param>
|
||||
public static AssetInfo GetAssetInfoByGUID(string assetGUID)
|
||||
{
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.GetAssetInfoByGUID(assetGUID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源信息
|
||||
/// </summary>
|
||||
/// <param name="assetGUID">资源GUID</param>
|
||||
/// <param name="type">资源类型</param>
|
||||
public static AssetInfo GetAssetInfoByGUID(string assetGUID, System.Type type)
|
||||
{
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.GetAssetInfoByGUID(assetGUID, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查资源定位地址是否有效
|
||||
/// </summary>
|
||||
@@ -499,7 +531,18 @@ namespace YooAsset
|
||||
|
||||
#region 资源解压
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// 创建内置资源解压器,用于解压当前资源版本所有的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
/// <param name="failedTryAgain">解压失败的重试次数</param>
|
||||
public static ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
||||
{
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.CreateResourceUnpacker(unpackingMaxNumber, failedTryAgain);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器,用于解压指定的资源标签关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tag">资源标签</param>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
@@ -511,7 +554,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// 创建内置资源解压器,用于解压指定的资源标签列表关联的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="tags">资源标签列表</param>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
@@ -521,16 +564,20 @@ namespace YooAsset
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.CreateResourceUnpacker(tags, unpackingMaxNumber, failedTryAgain);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 资源导入
|
||||
/// <summary>
|
||||
/// 创建内置资源解压器
|
||||
/// 创建资源导入器
|
||||
/// 注意:资源文件名称必须和资源服务器部署的文件名称一致!
|
||||
/// </summary>
|
||||
/// <param name="unpackingMaxNumber">同时解压的最大文件数</param>
|
||||
/// <param name="failedTryAgain">解压失败的重试次数</param>
|
||||
public static ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
|
||||
/// <param name="filePaths">资源路径列表</param>
|
||||
/// <param name="importerMaxNumber">同时导入的最大文件数</param>
|
||||
/// <param name="failedTryAgain">导入失败的重试次数</param>
|
||||
public static ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
|
||||
{
|
||||
DebugCheckDefaultPackageValid();
|
||||
return _defaultPackage.CreateResourceUnpacker(unpackingMaxNumber, failedTryAgain);
|
||||
return _defaultPackage.CreateResourceImporter(filePaths, importerMaxNumber, failedTryAgain);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -93,6 +93,9 @@ public class LoadAssetsByTagOperation<TObject> : GameAsyncOperation where TObjec
|
||||
SetFinish(true);
|
||||
}
|
||||
}
|
||||
protected override void OnAbort()
|
||||
{
|
||||
}
|
||||
private void SetFinish(bool succeed, string error = "")
|
||||
{
|
||||
Error = error;
|
||||
|
||||
@@ -91,6 +91,8 @@ internal class FsmInitializePackage : IStateNode
|
||||
}
|
||||
else
|
||||
{
|
||||
var version = package.GetPackageVersion();
|
||||
Debug.Log($"Init resource package version : {version}");
|
||||
_machine.ChangeState<FsmUpdatePackageVersion>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ public class PatchOperation : GameAsyncOperation
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnAbort()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接收事件
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.tuyoogame.yooasset",
|
||||
"displayName": "YooAsset",
|
||||
"version": "2.0.0-preview",
|
||||
"version": "2.0.1-preview",
|
||||
"unity": "2019.4",
|
||||
"description": "unity3d resources management system.",
|
||||
"author": {
|
||||
|
||||
Reference in New Issue
Block a user