首次提交
This commit is contained in:
64
Assets/Scripts/NBC/Asset/Runtime/Address/Info/AssetInfo.cs
Normal file
64
Assets/Scripts/NBC/Asset/Runtime/Address/Info/AssetInfo.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace NBC.Asset
|
||||
{
|
||||
public class AssetInfo
|
||||
{
|
||||
private readonly AssetData _assetData;
|
||||
|
||||
// public AssetData Data => _assetData;
|
||||
|
||||
/// <summary>
|
||||
/// 资源路径
|
||||
/// </summary>
|
||||
public string Path { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源类型
|
||||
/// </summary>
|
||||
public Type AssetType { private set; get; }
|
||||
|
||||
|
||||
private string _providerGUID;
|
||||
|
||||
/// <summary>
|
||||
/// 唯一标识符
|
||||
/// </summary>
|
||||
public string GUID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_providerGUID))
|
||||
return _providerGUID;
|
||||
|
||||
_providerGUID = Util.GetAssetGUID(Path, AssetType);
|
||||
return _providerGUID;
|
||||
}
|
||||
}
|
||||
|
||||
public AssetInfo(AssetData assetData, System.Type assetType)
|
||||
{
|
||||
if (assetData == null)
|
||||
throw new Exception("assetData is null!");
|
||||
|
||||
_assetData = assetData;
|
||||
AssetType = assetType;
|
||||
Path = assetData.Path;
|
||||
}
|
||||
|
||||
public AssetInfo(AssetData assetData)
|
||||
{
|
||||
if (assetData == null)
|
||||
throw new System.Exception("assetData is null!");
|
||||
|
||||
_assetData = assetData;
|
||||
AssetType = null;
|
||||
Path = assetData.Path;
|
||||
}
|
||||
|
||||
public bool HasTag(string[] tags)
|
||||
{
|
||||
return _assetData.HasTag(tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7edf10c26d554a3d8c03c099062093dd
|
||||
timeCreated: 1676965484
|
||||
44
Assets/Scripts/NBC/Asset/Runtime/Address/Info/BundleInfo.cs
Normal file
44
Assets/Scripts/NBC/Asset/Runtime/Address/Info/BundleInfo.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC.Asset
|
||||
{
|
||||
public class BundleInfo
|
||||
{
|
||||
public readonly BundleData Bundle;
|
||||
public BundleLoadMode LoadMode;
|
||||
|
||||
|
||||
public BundleInfo(BundleData bundleData)
|
||||
{
|
||||
Bundle = bundleData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 资源地址
|
||||
/// </summary>
|
||||
public string BundlePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LoadMode == BundleLoadMode.LoadFromStreaming)
|
||||
{
|
||||
Debug.Log($"LoadMode={LoadMode} path+{Bundle.StreamingFilePath}");
|
||||
return Bundle.StreamingFilePath;
|
||||
}
|
||||
|
||||
if (LoadMode == BundleLoadMode.LoadFromCache)
|
||||
{
|
||||
Debug.Log($"LoadMode={LoadMode} path+{Bundle.CachedDataFilePath}");
|
||||
return Bundle.CachedDataFilePath;
|
||||
}
|
||||
|
||||
if (LoadMode == BundleLoadMode.LoadFromRemote)
|
||||
{
|
||||
return Bundle.RemoteDataFilePath;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a2f72ad8fc649bc805449e37b9540f2
|
||||
timeCreated: 1677118210
|
||||
Reference in New Issue
Block a user