Add get asset info method.

增加获取资源信息的方法。
This commit is contained in:
hevinci
2022-05-03 12:23:08 +08:00
parent 665a16fe60
commit 9ec841ff67
9 changed files with 258 additions and 59 deletions
@@ -0,0 +1,27 @@
namespace YooAsset
{
public class AssetInfo
{
/// <summary>
/// 资源路径
/// </summary>
public string AssetPath { private set; get; }
/// <summary>
/// 资源类型
/// </summary>
public System.Type AssetType { private set; get; }
public AssetInfo(string assetPath, System.Type assetType)
{
AssetPath = assetPath;
AssetType = assetType;
}
public AssetInfo(string assetPath)
{
AssetPath = assetPath;
AssetType = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07db4f624e6cf80468fadd9e94691017
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -82,7 +82,7 @@ namespace YooAsset
}
else
{
throw new Exception($"Invalid depend id : {dependID} Asset path : {assetPath}");
throw new Exception($"Invalid bundle id : {dependID} Asset path : {assetPath}");
}
}
return result.ToArray();
@@ -109,7 +109,7 @@ namespace YooAsset
}
else
{
throw new Exception($"Invalid depend id : {bundleID} Asset path : {assetPath}");
throw new Exception($"Invalid bundle id : {bundleID} Asset path : {assetPath}");
}
}
else
@@ -135,7 +135,7 @@ namespace YooAsset
}
else
{
throw new Exception($"Invalid depend id : {bundleID} Asset path : {patchAsset.AssetPath}");
throw new Exception($"Invalid bundle id : {bundleID} Asset path : {patchAsset.AssetPath}");
}
}
return string.Empty;
@@ -47,6 +47,10 @@ namespace YooAsset
return bundleInfo;
}
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTag(AppPatchManifest, tags);
}
string IBundleServices.MappingToAssetPath(string location)
{
return AppPatchManifest.MappingToAssetPath(location);
@@ -309,6 +309,10 @@ namespace YooAsset
return bundleInfo;
}
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTag(LocalPatchManifest, tags);
}
string IBundleServices.MappingToAssetPath(string location)
{
return LocalPatchManifest.MappingToAssetPath(location);
@@ -56,6 +56,10 @@ namespace YooAsset
return bundleInfo;
}
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return PatchHelper.GetAssetsInfoByTag(AppPatchManifest, tags);
}
string IBundleServices.MappingToAssetPath(string location)
{
return AppPatchManifest.MappingToAssetPath(location);