This commit is contained in:
2025-11-12 14:22:04 +08:00
parent 7c8bb4b46c
commit 7aeda74f41
15 changed files with 280 additions and 129 deletions

View File

@@ -7,11 +7,11 @@ namespace Stary.Evo.TableTextConversion
{
public interface IUITableDataCore : ITableDataCore
{
UniTask<Stary.Evo.TableTextConversion.UITableData.MessageInfo> GetUIInfo(string uiid);
UniTask<Sprite> GetSprite(string uiid);
UniTask<UIEntity> GetUIAssetInfo(string uiid);
UniTask<Sprite> GetSpriteAsset(string uiid);
}
#if YooAssets
public class UITableDataCore : IUITableDataCore, IDisposable
{
public string TableName => "Config_UITableData";
@@ -21,9 +21,9 @@ namespace Stary.Evo.TableTextConversion
public async UniTask LoadData()
{
var handle = YooAssets.LoadAssetAsync<Stary.Evo.TableTextConversion.UITableData>(TableName);
var handle = YooAssets.LoadAssetAsync<UITableData>(TableName);
await handle.Task;
uiTableDatas = handle.GetAssetObject<Stary.Evo.TableTextConversion.UITableData>();
uiTableDatas = handle.GetAssetObject<UITableData>();
if (uiTableDatas == null)
{
Debug.LogError($"加载UI表失败请排查config下是否存在【{TableName}】表");
@@ -32,7 +32,7 @@ namespace Stary.Evo.TableTextConversion
IsLoad = true;
}
public async UniTask<Stary.Evo.TableTextConversion.UITableData.MessageInfo> GetUIInfo(string uiid)
public async UniTask<UIEntity> GetUIAssetInfo(string uiid)
{
if (!IsLoad)
{
@@ -48,14 +48,14 @@ namespace Stary.Evo.TableTextConversion
return info;
}
public async UniTask<Sprite> GetSprite(string uiid)
public async UniTask<Sprite> GetSpriteAsset(string uiid)
{
if (!IsLoad)
{
await LoadData();
}
var info = await GetUIInfo(uiid);
var info = await GetUIAssetInfo(uiid);
var handle = YooAssets.LoadAssetAsync<Sprite>(info.filename);
await handle.Task;
if (handle.Status == EOperationStatus.Succeed)
@@ -76,4 +76,5 @@ namespace Stary.Evo.TableTextConversion
uiTableDatas = null;
}
}
#endif
}