This commit is contained in:
Han
2025-04-01 18:26:48 +08:00
parent c3e2616c3a
commit ac499e2202
39 changed files with 1258 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3f4958b2707b1874fb59e045842881b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
namespace Stary.Evo.TableTextConversion
{
public interface ITableData
{
public string TableName { get; }
}
public enum TableName
{
AudioTableData,
AudioTextData
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 33bd2c65630947399d1eb3e8c3e454c1
timeCreated: 1743415380

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f458924b47972e344ab95e73c17cec83
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Stary.Evo.TableTextConversion
{
public class AudioTableData : ScriptableObject, ITableData
{
public string TableName { get; }
public List<MessageInfo> infos;
[Serializable]
public class MessageInfo
{
// 序号
[GUIColor(0, 1, 0)] public int index;
// 名称
public string name;
// 名称描述
public string nameMessage;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2123856275778e24ebda59ff88f2d153
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Stary.Evo.TableTextConversion
{
public class UITableData : ScriptableObject, ITableData
{
public string TableName { get; }
public List<MessageInfo> infos;
[Serializable]
public class MessageInfo
{
// 序号
[GUIColor(0, 1, 0)] public int index;
// 名称
public string name;
// 名称描述
public string nameMessage;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d87122eaab924cad9155ee33a31ebcc3
timeCreated: 1743496104

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using Stary.Evo.TableTextConversion;
public class Test : MonoBehaviour
{
// Start is called before the first frame update
/*async void Start()
{
Task<AudioTableData> audioTableData = ReadDumpInformation.Read<AudioTableData>();
await audioTableData;
AudioTableData data = audioTableData.Result;
if (data != null)
{
Debug.Log($"UnityEvo:{data.infos[3].name}");
}
}*/
void Start()
{
AudioTableData audioTableData = ReadDumpInformation.ReadInEditor<AudioTableData>();
if (audioTableData != null)
{
Debug.Log($"UnityEvo:{audioTableData.infos[3].name}");
}
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5cc8857da4ee2534289add72195af962
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 102768b9489625641a18c187eac264be
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 64089130470a47d496bd6c8168cd95f6
timeCreated: 1743415570