mirror of https://github.com/tuyoogame/YooAsset
update resource package
parent
bae55ca511
commit
4234885f94
|
@ -93,17 +93,6 @@ namespace YooAsset
|
||||||
AssetType = assetType;
|
AssetType = assetType;
|
||||||
Error = string.Empty;
|
Error = string.Empty;
|
||||||
}
|
}
|
||||||
internal AssetInfo(string packageName, PackageAsset packageAsset)
|
|
||||||
{
|
|
||||||
if (packageAsset == null)
|
|
||||||
throw new System.Exception("Should never get here !");
|
|
||||||
|
|
||||||
_providerGUID = string.Empty;
|
|
||||||
_packageAsset = packageAsset;
|
|
||||||
PackageName = packageName;
|
|
||||||
AssetType = null;
|
|
||||||
Error = string.Empty;
|
|
||||||
}
|
|
||||||
internal AssetInfo(string packageName, string error)
|
internal AssetInfo(string packageName, string error)
|
||||||
{
|
{
|
||||||
_providerGUID = string.Empty;
|
_providerGUID = string.Empty;
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (packageAsset.HasTag(tags))
|
if (packageAsset.HasTag(tags))
|
||||||
{
|
{
|
||||||
AssetInfo assetInfo = new AssetInfo(PackageName, packageAsset);
|
AssetInfo assetInfo = new AssetInfo(PackageName, packageAsset, null);
|
||||||
result.Add(assetInfo);
|
result.Add(assetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,6 +447,17 @@ namespace YooAsset
|
||||||
return ConvertLocationToAssetInfo(location, null);
|
return ConvertLocationToAssetInfo(location, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location">资源的定位地址</param>
|
||||||
|
/// <param name="type">资源类型</param>
|
||||||
|
public AssetInfo GetAssetInfo(string location, System.Type type)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
return ConvertLocationToAssetInfo(location, type);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源信息
|
/// 获取资源信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -457,6 +468,17 @@ namespace YooAsset
|
||||||
return ConvertAssetGUIDToAssetInfo(assetGUID, null);
|
return ConvertAssetGUIDToAssetInfo(assetGUID, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetGUID">资源GUID</param>
|
||||||
|
/// <param name="type">资源类型</param>
|
||||||
|
public AssetInfo GetAssetInfoByGUID(string assetGUID, System.Type type)
|
||||||
|
{
|
||||||
|
DebugCheckInitialize();
|
||||||
|
return ConvertAssetGUIDToAssetInfo(assetGUID, type);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查资源定位地址是否有效
|
/// 检查资源定位地址是否有效
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -674,6 +696,7 @@ namespace YooAsset
|
||||||
private AssetHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
private AssetHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadMethod(nameof(LoadAssetAsync));
|
DebugCheckAssetLoadMethod(nameof(LoadAssetAsync));
|
||||||
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
var handle = _resourceMgr.LoadAssetAsync(assetInfo);
|
var handle = _resourceMgr.LoadAssetAsync(assetInfo);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
|
@ -779,6 +802,7 @@ namespace YooAsset
|
||||||
private SubAssetsHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
private SubAssetsHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadMethod(nameof(LoadSubAssetsAsync));
|
DebugCheckAssetLoadMethod(nameof(LoadSubAssetsAsync));
|
||||||
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
var handle = _resourceMgr.LoadSubAssetsAsync(assetInfo);
|
var handle = _resourceMgr.LoadSubAssetsAsync(assetInfo);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
|
@ -884,6 +908,7 @@ namespace YooAsset
|
||||||
private AllAssetsHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
private AllAssetsHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadMethod(nameof(LoadAllAssetsAsync));
|
DebugCheckAssetLoadMethod(nameof(LoadAllAssetsAsync));
|
||||||
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
var handle = _resourceMgr.LoadAllAssetsAsync(assetInfo);
|
var handle = _resourceMgr.LoadAllAssetsAsync(assetInfo);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
|
@ -1109,6 +1134,18 @@ namespace YooAsset
|
||||||
throw new Exception($"Cannot load raw file using {method} method !");
|
throw new Exception($"Cannot load raw file using {method} method !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void DebugCheckAssetLoadType(System.Type type)
|
||||||
|
{
|
||||||
|
if (type == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (typeof(UnityEngine.Object).IsAssignableFrom(type) == false)
|
||||||
|
{
|
||||||
|
throw new Exception($"Load asset type is invalid : {type.FullName} !");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 调试信息
|
#region 调试信息
|
||||||
|
|
Loading…
Reference in New Issue