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
@@ -1,8 +1,35 @@
using System.IO;
namespace YooAsset
{
public class AssetInfo
{
private readonly PatchAsset _patchAsset;
private string _providerGUID;
/// <summary>
/// 资源提供者唯一标识符
/// </summary>
internal string ProviderGUID
{
get
{
if (string.IsNullOrEmpty(_providerGUID) == false)
return _providerGUID;
if (AssetType == null)
_providerGUID = $"{AssetPath}[null]";
else
_providerGUID = $"{AssetPath}[{AssetType.Name}]";
return _providerGUID;
}
}
/// <summary>
/// 资源对象名称
/// </summary>
public string AssetName { private set; get; }
/// <summary>
/// 资源路径
/// </summary>
@@ -13,15 +40,55 @@ namespace YooAsset
/// </summary>
public System.Type AssetType { private set; get; }
public AssetInfo(string assetPath, System.Type assetType)
/// <summary>
/// 身份是否无效
/// </summary>
public bool IsInvalid
{
AssetPath = assetPath;
AssetType = assetType;
get
{
return _patchAsset == null;
}
}
public AssetInfo(string assetPath)
/// <summary>
/// 错误信息
/// </summary>
public string Error { private set; get; }
private AssetInfo()
{
AssetPath = assetPath;
}
internal AssetInfo(PatchAsset patchAsset, System.Type assetType)
{
if (patchAsset == null)
throw new System.Exception("Should never get here !");
_patchAsset = patchAsset;
AssetType = assetType;
AssetPath = patchAsset.AssetPath;
AssetName = Path.GetFileName(patchAsset.AssetPath);
Error = string.Empty;
}
internal AssetInfo(PatchAsset patchAsset)
{
if (patchAsset == null)
throw new System.Exception("Should never get here !");
_patchAsset = patchAsset;
AssetType = null;
AssetPath = patchAsset.AssetPath;
AssetName = Path.GetFileName(patchAsset.AssetPath);
Error = string.Empty;
}
internal AssetInfo(string error)
{
_patchAsset = null;
AssetType = null;
AssetPath = string.Empty;
AssetName = string.Empty;
Error = error;
}
}
}