Optimized asset system and patch system framework

优化了资源定位不正确导致的错误报告方式。
YooAssets.ProcessOperation()重命名为YooAssets.StartOperation()
YooAssets.GetBundleInfo()已经移除方法。
YooAssets.IsNeedDownloadFromRemote()新增加方法。
This commit is contained in:
hevinci
2022-05-11 16:48:17 +08:00
parent 67eeae31c7
commit 4cad587609
34 changed files with 726 additions and 573 deletions
@@ -16,7 +16,7 @@ namespace YooAsset
{
_locationToLower = locationToLower;
var operation = new EditorSimulateModeInitializationOperation(this, simulatePatchManifestPath);
OperationSystem.ProcessOperaiton(operation);
OperationSystem.StartOperaiton(operation);
return operation;
}
@@ -38,44 +38,41 @@ namespace YooAsset
}
#region IBundleServices接口
BundleInfo IBundleServices.GetBundleInfo(string bundleName)
BundleInfo IBundleServices.GetBundleInfo(AssetInfo assetInfo)
{
if (string.IsNullOrEmpty(bundleName))
return new BundleInfo(string.Empty);
if(assetInfo.IsInvalid)
throw new Exception("Should never get here !");
string bundleName = _simulatePatchManifest.GetBundleName(assetInfo.AssetPath);
if (_simulatePatchManifest.Bundles.TryGetValue(bundleName, out PatchBundle patchBundle))
{
string mainAssetPath = _simulatePatchManifest.TryGetBundleMainAssetPath(bundleName);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, mainAssetPath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath);
return bundleInfo;
}
else
{
YooLogger.Warning($"Not found bundle in patch manifest : {bundleName}");
BundleInfo bundleInfo = new BundleInfo(bundleName);
return bundleInfo;
throw new Exception("Should never get here !");
}
}
AssetInfo[] IBundleServices.GetAssetInfos(string bundleName)
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
{
return PatchHelper.GetAssetsInfoByBundleName(_simulatePatchManifest, bundleName);
throw new NotImplementedException();
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTags(_simulatePatchManifest, tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{
if (_simulatePatchManifest.Assets.TryGetValue(assetPath, out PatchAsset patchAsset))
return patchAsset;
else
return null;
}
string IBundleServices.MappingToAssetPath(string location)
{
return _simulatePatchManifest.MappingToAssetPath(location);
}
string IBundleServices.GetBundleName(string assetPath)
{
return _simulatePatchManifest.GetBundleName(assetPath);
}
string[] IBundleServices.GetAllDependencies(string assetPath)
{
return _simulatePatchManifest.GetAllDependencies(assetPath);
}
#endregion
}
}