1.01
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace Stary.Evo.TableTextConversion
|
||||
{
|
||||
public static class ReadDumpInformation
|
||||
{
|
||||
public static async Task<T> Read<T>() where T : ScriptableObject, ITableData
|
||||
{
|
||||
var conf = YooAssets.LoadAssetAsync($"Config_{typeof(T).Name}");
|
||||
await conf.Task;
|
||||
if (conf.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
return conf.AssetObject as T;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("UnityEvo:" + "配置文件:" + typeof(T).Name + "加载失败!!!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static T ReadInEditor<T>() where T : ScriptableObject, ITableData
|
||||
{
|
||||
// 同步加载并直接返回结果
|
||||
var conf = Resources.Load<T>(typeof(T).Name);
|
||||
|
||||
if (conf != null)
|
||||
{
|
||||
return conf;
|
||||
}
|
||||
|
||||
Debug.LogError($"UnityEvo:配置文件同步加载失败:{typeof(T).Name}");
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64089130470a47d496bd6c8168cd95f6
|
||||
timeCreated: 1743415570
|
||||
Reference in New Issue
Block a user