1.01
This commit is contained in:
8
Assets/05.TableTextConversion/RunTime/Abstract.meta
Normal file
8
Assets/05.TableTextConversion/RunTime/Abstract.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f4958b2707b1874fb59e045842881b7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs
Normal file
12
Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Stary.Evo.TableTextConversion
|
||||
{
|
||||
public interface ITableData
|
||||
{
|
||||
public string TableName { get; }
|
||||
}
|
||||
public enum TableName
|
||||
{
|
||||
AudioTableData,
|
||||
AudioTextData
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33bd2c65630947399d1eb3e8c3e454c1
|
||||
timeCreated: 1743415380
|
||||
8
Assets/05.TableTextConversion/RunTime/Base.meta
Normal file
8
Assets/05.TableTextConversion/RunTime/Base.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f458924b47972e344ab95e73c17cec83
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs
Normal file
25
Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2123856275778e24ebda59ff88f2d153
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/05.TableTextConversion/RunTime/Base/UITableData.cs
Normal file
25
Assets/05.TableTextConversion/RunTime/Base/UITableData.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d87122eaab924cad9155ee33a31ebcc3
|
||||
timeCreated: 1743496104
|
||||
34
Assets/05.TableTextConversion/RunTime/Test.cs
Normal file
34
Assets/05.TableTextConversion/RunTime/Test.cs
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/05.TableTextConversion/RunTime/Test.cs.meta
Normal file
11
Assets/05.TableTextConversion/RunTime/Test.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5cc8857da4ee2534289add72195af962
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/05.TableTextConversion/RunTime/Use.meta
Normal file
8
Assets/05.TableTextConversion/RunTime/Use.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 102768b9489625641a18c187eac264be
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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