12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
-
- namespace YooAsset
- {
- internal class DatabaseRawFileProvider : ProviderBase
- {
- public DatabaseRawFileProvider(AssetSystemImpl impl, string providerGUID, AssetInfo assetInfo) : base(impl, providerGUID, assetInfo)
- {
- }
- public override void Update()
- {
- #if UNITY_EDITOR
- if (IsDone)
- return;
- if (Status == EStatus.None)
- {
- // 检测资源文件是否存在
- string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath);
- if (string.IsNullOrEmpty(guid))
- {
- Status = EStatus.Failed;
- LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
- YooLogger.Error(LastError);
- InvokeCompletion();
- return;
- }
- Status = EStatus.CheckBundle;
- // 注意:模拟异步加载效果提前返回
- if (IsWaitForAsyncComplete == false)
- return;
- }
- // 1. 检测资源包
- if (Status == EStatus.CheckBundle)
- {
- if (IsWaitForAsyncComplete)
- {
- OwnerBundle.WaitForAsyncComplete();
- }
- if (OwnerBundle.IsDone() == false)
- return;
- if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
- {
- Status = EStatus.Failed;
- LastError = OwnerBundle.LastError;
- InvokeCompletion();
- return;
- }
- Status = EStatus.Checking;
- }
- // 2. 检测加载结果
- if (Status == EStatus.Checking)
- {
- RawFilePath = MainAssetInfo.AssetPath;
- Status = EStatus.Succeed;
- InvokeCompletion();
- }
- #endif
- }
- }
- }
|