From 8ff666d5e2403072a6076107f4f3165194a1354f Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 8 Mar 2023 12:48:57 +0800 Subject: [PATCH] update patch system --- .../YooAsset/Runtime/PatchSystem/AssetInfo.cs | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs b/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs index 6b534b7..215b66f 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs @@ -6,6 +6,17 @@ namespace YooAsset private readonly PatchAsset _patchAsset; private string _providerGUID; + /// + /// 资源类型 + /// + public System.Type AssetType { private set; get; } + + /// + /// 错误信息 + /// + public string Error { private set; get; } + + /// /// 唯一标识符 /// @@ -35,40 +46,45 @@ namespace YooAsset } } - /// - /// 错误信息 - /// - internal string Error { private set; get; } - /// /// 可寻址地址 /// - public string Address { private set; get; } + public string Address + { + get + { + if (_patchAsset == null) + return string.Empty; + return _patchAsset.Address; + } + } /// /// 资源路径 /// - public string AssetPath { private set; get; } - - /// - /// 资源类型 - /// - public System.Type AssetType { private set; get; } + public string AssetPath + { + get + { + if (_patchAsset == null) + return string.Empty; + return _patchAsset.AssetPath; + } + } - // 注意:这是一个内部类,严格限制外部创建。 private AssetInfo() { + // 注意:禁止从外部创建该类 } internal AssetInfo(PatchAsset patchAsset, System.Type assetType) { if (patchAsset == null) throw new System.Exception("Should never get here !"); + _providerGUID = string.Empty; _patchAsset = patchAsset; AssetType = assetType; - Address = patchAsset.Address; - AssetPath = patchAsset.AssetPath; Error = string.Empty; } internal AssetInfo(PatchAsset patchAsset) @@ -76,18 +92,16 @@ namespace YooAsset if (patchAsset == null) throw new System.Exception("Should never get here !"); + _providerGUID = string.Empty; _patchAsset = patchAsset; AssetType = null; - Address = patchAsset.Address; - AssetPath = patchAsset.AssetPath; Error = string.Empty; } internal AssetInfo(string error) { + _providerGUID = string.Empty; _patchAsset = null; AssetType = null; - Address = string.Empty; - AssetPath = string.Empty; Error = error; } }