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
@@ -18,19 +18,9 @@ namespace YooAsset
}
/// <summary>
/// 资源路径
/// 资源信息
/// </summary>
public string AssetPath { private set; get; }
/// <summary>
/// 资源对象的名称
/// </summary>
public string AssetName { private set; get; }
/// <summary>
/// 资源对象的类型
/// </summary>
public System.Type AssetType { private set; get; }
public AssetInfo MainAssetInfo { private set; get; }
/// <summary>
/// 获取的资源对象
@@ -95,11 +85,9 @@ namespace YooAsset
private readonly List<OperationHandleBase> _handles = new List<OperationHandleBase>();
public ProviderBase(string assetPath, System.Type assetType)
public ProviderBase(AssetInfo assetInfo)
{
AssetPath = assetPath;
AssetName = System.IO.Path.GetFileName(assetPath);
AssetType = assetType;
MainAssetInfo = assetInfo;
}
/// <summary>
@@ -126,25 +114,38 @@ namespace YooAsset
return RefCount <= 0;
}
/// <summary>
/// 是否为场景提供者
/// </summary>
public bool IsSceneProvider()
{
if (this is BundledSceneProvider || this is DatabaseSceneProvider)
return true;
else
return false;
}
/// <summary>
/// 创建操作句柄
/// </summary>
/// <returns></returns>
public OperationHandleBase CreateHandle()
public T CreateHandle<T>() where T : OperationHandleBase
{
// 引用计数增加
RefCount++;
OperationHandleBase handle;
if (IsSceneProvider())
if (typeof(T) == typeof(AssetOperationHandle))
handle = new AssetOperationHandle(this);
else if (typeof(T) == typeof(SceneOperationHandle))
handle = new SceneOperationHandle(this);
else if (IsSubAssetsProvider())
else if (typeof(T) == typeof(SubAssetsOperationHandle))
handle = new SubAssetsOperationHandle(this);
else
handle = new AssetOperationHandle(this);
throw new System.NotImplementedException();
_handles.Add(handle);
return handle;
return handle as T;
}
/// <summary>
@@ -175,7 +176,7 @@ namespace YooAsset
// 验证结果
if (IsDone == false)
{
YooLogger.Warning($"WaitForAsyncComplete failed to loading : {AssetPath}");
YooLogger.Warning($"WaitForAsyncComplete failed to loading : {MainAssetInfo.AssetPath}");
}
}
@@ -196,21 +197,6 @@ namespace YooAsset
}
}
public bool IsSceneProvider()
{
if (this is BundledSceneProvider || this is DatabaseSceneProvider)
return true;
else
return false;
}
public bool IsSubAssetsProvider()
{
if (this is BundledSubAssetsProvider || this is DatabaseSubAssetsProvider)
return true;
else
return false;
}
#region 异步编程相关
private TaskCompletionSource<object> _taskCompletionSource;
protected void InvokeCompletion()