UI 文本转换开发

This commit is contained in:
2025-04-25 10:02:32 +08:00
parent 748be76146
commit bb0ef93e78
3 changed files with 115 additions and 47 deletions

View File

@@ -86,8 +86,9 @@ namespace Stary.Evo.TableTextConversion
{
for (int i = 0; i < result.Tables.Count; i++)
{
var table = result.Tables[i];
//开始遍历说有table表
int oneRows = result.Tables[i].Rows.Count; //行数
int oneRows = table.Rows.Count; //行数
Dictionary<int, int> dict_Question = new Dictionary<int, int>();
Dictionary<int, int> dict_Menu = new Dictionary<int, int>();
@@ -96,18 +97,18 @@ namespace Stary.Evo.TableTextConversion
int VoiceCount = 0;
for (int j = 0; j < oneRows; j++)
{
string key = FilterTo(result.Tables[i].Rows[j][0].ToString());
if (!string.IsNullOrEmpty(key))
{
VoiceCount++;
}
// string key = FilterTo(table.Rows[j][0].ToString());
// if (!string.IsNullOrEmpty(key))
// {
VoiceCount++;
// }
}
#endregion
#region AudioTableData
if (result.Tables[i].TableName == "audio")
if (table.TableName.ToLower() == "audio")
{
#region
@@ -118,21 +119,25 @@ namespace Stary.Evo.TableTextConversion
//获取对话块
messageInfo.index = j - 1;
//文件名称
messageInfo.auid = FilterTo(result.Tables[i].Rows[j][0].ToString());
messageInfo.auid = FilterTo(table.Rows[j][0].ToString());
//获取内容
messageInfo.autype = Enum.TryParse(FilterTo(result.Tables[i].Rows[j][1].ToString()), out AudioTableData.AudioType auType)? auType : AudioTableData.AudioType.Null;
messageInfo.autype =
Enum.TryParse(FilterTo(table.Rows[j][1].ToString()),
out AudioTableData.AudioType auType)
? auType
: AudioTableData.AudioType.Null;
//获取描述
messageInfo.filename = FilterTo(result.Tables[i].Rows[j][2].ToString());
messageInfo.filename = FilterTo(table.Rows[j][2].ToString());
messageInfo.voice = FilterTo(result.Tables[i].Rows[j][3].ToString());
messageInfo.voice = FilterTo(table.Rows[j][3].ToString());
messageInfo.trigger = FilterTo(result.Tables[i].Rows[j][4].ToString());
messageInfo.uirelated =FilterTo(result.Tables[i].Rows[j][5].ToString());
messageInfo.description = FilterTo(result.Tables[i].Rows[j][6].ToString());
messageInfo.format = FilterTo(result.Tables[i].Rows[j][7].ToString());
messageInfo.notes = FilterTo(result.Tables[i].Rows[j][8].ToString());
messageInfo.trigger = FilterTo(table.Rows[j][4].ToString());
messageInfo.uirelated = FilterTo(table.Rows[j][5].ToString());
messageInfo.description = FilterTo(table.Rows[j][6].ToString());
messageInfo.format = FilterTo(table.Rows[j][7].ToString());
messageInfo.notes = FilterTo(table.Rows[j][8].ToString());
//添加数据
messageInfos.Add(messageInfo);
}
@@ -147,9 +152,10 @@ namespace Stary.Evo.TableTextConversion
}
#endregion
#region VideoTableData
if (result.Tables[i].TableName == "video")
if (table.TableName.ToLower() == "video")
{
#region
@@ -160,18 +166,23 @@ namespace Stary.Evo.TableTextConversion
//获取对话块
messageInfo.index = j - 1;
//文件名称
messageInfo.vidid = FilterTo(result.Tables[i].Rows[j][0].ToString());
messageInfo.vidid = FilterTo(table.Rows[j][0].ToString());
//获取内容
messageInfo.filename = FilterTo(result.Tables[i].Rows[j][1].ToString());
messageInfo.filename = FilterTo(table.Rows[j][1].ToString());
//获取描述
messageInfo.vidtype = FilterTo(result.Tables[i].Rows[j][2].ToString());
messageInfo.vidtype = FilterTo(table.Rows[j][2].ToString());
messageInfo.location = FilterTo(result.Tables[i].Rows[j][3].ToString());
messageInfo.location = FilterTo(table.Rows[j][3].ToString());
messageInfo.time = float.TryParse(FilterTo(result.Tables[i].Rows[j][4].ToString()), out float start) ? start : 0;
messageInfo.subtitle = FilterTo(result.Tables[i].Rows[j][5].ToString()).Equals("是")? true : false;
messageInfo.notes = FilterTo(result.Tables[i].Rows[j][6].ToString());
messageInfo.time =
float.TryParse(FilterTo(table.Rows[j][4].ToString()), out float start)
? start
: 0;
messageInfo.subtitle = FilterTo(table.Rows[j][5].ToString()).Equals("是")
? true
: false;
messageInfo.notes = FilterTo(table.Rows[j][6].ToString());
//添加数据
messageInfos.Add(messageInfo);
}
@@ -186,39 +197,86 @@ namespace Stary.Evo.TableTextConversion
}
#endregion
#region UITableData
if (result.Tables[i].TableName == "ui")
if (table.TableName.ToLower() == "ui")
{
#region
List<UITableData.MessageInfo> messageInfos = new List<UITableData.MessageInfo>();
UITableData.MessageInfo messageInfo = null;
List<UITableData.SubtitleInfo> subtitle = null;
int infoIndex = 0;
for (int j = 1; j < VoiceCount; j++)
{
UITableData.MessageInfo messageInfo = new UITableData.MessageInfo();
//获取对话块
messageInfo.index = j - 1;
//文件名称
messageInfo.uiid = FilterTo(result.Tables[i].Rows[j][0].ToString());
//获取内容
messageInfo.filename = FilterTo(result.Tables[i].Rows[j][1].ToString());
Debug.Log(j);
if (!table.Rows[j][0].ToString().Equals(""))
{
Debug.Log(table.Rows[j][0].ToString());
messageInfo = new UITableData.MessageInfo();
subtitle = new List<UITableData.SubtitleInfo>();
messageInfo.subtitle = subtitle;
//获取对话块
messageInfo.index = infoIndex;
//文件名称
messageInfo.uiid = FilterTo(table.Rows[j][0].ToString());
//获取内容
messageInfo.filename = FilterTo(table.Rows[j][1].ToString());
//获取描述
messageInfo.uitype = FilterTo(result.Tables[i].Rows[j][2].ToString());
//获取描述
messageInfo.uitype = FilterTo(table.Rows[j][2].ToString());
messageInfo.nodelocation = FilterTo(result.Tables[i].Rows[j][3].ToString());
if (!table.Rows[j][3].ToString().Equals(""))
{
var subtitleInfo = new UITableData.SubtitleInfo();
subtitleInfo.lineid = FilterTo(table.Rows[j][3].ToString());
subtitleInfo.subtitle = FilterTo(table.Rows[j][4].ToString());
subtitleInfo.start =
float.TryParse(FilterTo(table.Rows[j][5].ToString()),
out float start)
? start
: 0;
subtitleInfo.end = float.TryParse(FilterTo(table.Rows[j][6].ToString()),
out float end)
? end
: 0;
messageInfo.subtitle.Add(subtitleInfo);
}
messageInfo.description = FilterTo(result.Tables[i].Rows[j][4].ToString());
messageInfo.displaycondition = FilterTo(result.Tables[i].Rows[j][5].ToString());
messageInfo.animationrequirement = FilterTo(result.Tables[i].Rows[j][6].ToString());
messageInfo.size = FilterTo(result.Tables[i].Rows[j][7].ToString());
messageInfo.format = FilterTo(result.Tables[i].Rows[j][8].ToString());
messageInfo.notes = FilterTo(result.Tables[i].Rows[j][9].ToString());
//添加数据
messageInfos.Add(messageInfo);
messageInfo.nodelocation = FilterTo(table.Rows[j][7].ToString());
messageInfo.description = FilterTo(table.Rows[j][8].ToString());
messageInfo.displaycondition = FilterTo(table.Rows[j][9].ToString());
messageInfo.animationrequirement = FilterTo(table.Rows[j][10].ToString());
messageInfo.size = FilterTo(table.Rows[j][11].ToString());
messageInfo.format = FilterTo(table.Rows[j][12].ToString());
messageInfo.notes = FilterTo(table.Rows[j][13].ToString());
//添加数据
messageInfos.Add(messageInfo);
infoIndex++;
}
else
{
if (!table.Rows[j][3].ToString().Equals(""))
{
var subtitleInfo = new UITableData.SubtitleInfo();
subtitleInfo.lineid = FilterTo(table.Rows[j][3].ToString());
subtitleInfo.subtitle = FilterTo(table.Rows[j][4].ToString());
subtitleInfo.start =
float.TryParse(FilterTo(table.Rows[j][5].ToString()),
out float start)
? start
: 0;
subtitleInfo.end = float.TryParse(FilterTo(table.Rows[j][6].ToString()),
out float end)
? end
: 0;
messageInfo.subtitle.Add(subtitleInfo);
}
}
}
#endregion
@@ -230,6 +288,7 @@ namespace Stary.Evo.TableTextConversion
}
#endregion
#endregion
}
}