2024年1月1日发(作者:)

然后是UGuiForm

{ // 注释列 continue; } if (lumn(i)) { // 编号列 Line(" m_Id = t32();"); continue; } Format(" {0} = {1}();", e(i), e(i).Name).Ap } stringBuilder .AppendLine(" }") .AppendLine(" }") .AppendLine() .AppendLine(" GeneratePropertyArray();") .AppendLine(" return true;") .Append(" }"); return ng(); } private static string GenerateDataTableStreamParser(DataTableProcessor dataTableProcessor) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder .AppendLine(" public override bool ParseDataRow(GameFrameworkSegment dataRowSegment)") .AppendLine(" {") .AppendLine(" g("Not implemented ParseDataRow(GameFrameworkSegment)");") .AppendLine(" return false;") .Append(" }"); return ng(); } private static string GenerateDataTablePropertyArray(DataTableProcessor dataTableProcessor) { List propertyCollections = new List(); for (int i = 0; i < umnCount; i++) { if (entColumn(i)) { // 注释列 continue; } if (lumn(i)) { // 编号列 continue; } string name = e(i); if (!h(name)) { continue; } string propertyCollectionName = e(name, ); int id = ((name).Value);

PropertyCollection propertyCollection = null; foreach (PropertyCollection pc in propertyCollections) { if ( == propertyCollectionName) { propertyCollection = pc; break; } } if (propertyCollection == null) { propertyCollection = new PropertyCollection(propertyCollectionName, guageKeyword(i)); (propertyCollection); } m(id, name); } StringBuilder stringBuilder = new StringBuilder(); bool firstProperty = true; foreach (PropertyCollection propertyCollection in propertyCollections) { if (firstProperty) { firstProperty = false; } else { Line().AppendLine(); } stringBuilder .AppendFormat(" private KeyValuePair[] m_{0} = null;", , geKeyword).AppendLine() .AppendLine() .AppendFormat(" public int Get{0}(int id)", ).AppendLine() .AppendLine(" {") .AppendFormat(" foreach (KeyValuePair i in m_{0})", , geKeyword).AppendLine() .AppendLine(" {") .AppendLine(" if ( == id)") .AppendLine(" {") .AppendLine(" return ;") .AppendLine(" }") .AppendLine(" }") .AppendLine() .AppendLine(" }") .AppendLine() .AppendFormat(" public int Get{0}At(int index)", ).AppendLine() .AppendLine(" {") .AppendFormat(" if (index < 0 || index >= m_{0}.Length)", ).AppendLine() .AppendLine(" {") .AppendLine(" }") .AppendLine() .AppendFormat(" return m_{0}[index].Value;", ).AppendLine() .Append(" }"); } if ( > 0) { Line().AppendLine(); } stringBuilder .AppendFormat(" throw new GameFrameworkException(("Get{0} with invalid id '{{0}}'.", ng()));", propertyCollection .AppendFormat(" throw new GameFrameworkException(("Get{0}At with invalid index '{{0}}'.", ng()));", prope

.AppendLine(" private void GeneratePropertyArray()") .AppendLine(" {"); firstProperty = true; foreach (PropertyCollection propertyCollection in propertyCollections) { if (firstProperty) { firstProperty = false; } else { Line().AppendLine(); } stringBuilder .AppendFormat(" m_{0} = new KeyValuePair[]", , geKeyword).AppendLine() .AppendLine(" {"); int itemCount = unt; for (int i = 0; i < itemCount; i++) { KeyValuePair item = m(i); } (" };"); } stringBuilder .AppendLine() .Append(" }"); return ng(); } private sealed class PropertyCollection { private readonly string m_Name; private readonly string m_LanguageKeyword; private readonly List> m_Items; public PropertyCollection(string name, string languageKeyword) { m_Name = name; m_LanguageKeyword = languageKeyword; m_Items = new List>(); } public string Name { get { return m_Name; } } public string LanguageKeyword { get { return m_LanguageKeyword; } } Format(" new KeyValuePair({1}, {2}),", geKeyword, ng(),

public int ItemCount { get { return m_; } } public KeyValuePair GetItem(int index) { if (index < 0 || index >= m_) { throw new GameFrameworkException(("GetItem with invalid index '{0}'.", ng())); } return m_Items[index]; } public void AddItem(int id, string propertyName) { m_(new KeyValuePair(id, propertyName)); } } }}

//------------------------------------------------------------using GameFramework;using System;using nt;using GameMain;using UnityEngine;using e;namespace ble{ public static class DataTableExtension { //CSharp类的前置命名空间 private const string DataRowClassPrefixName = ""; internal const char DataSplitSeparator = 't'; internal const char DataTrimSeparator = '"'; public static void LoadDataTable(this DataTableComponent dataTableComponent, string dataTableName, LoadType loadType, object userData = null) { if (OrEmpty(dataTableName)) { g("Data table name is invalid."); return; } string[] splitNames = ('_'); if ( > 2) { g("Data table name is invalid."); return; } string dataRowClassName = DataRowClassPrefixName + splitNames[0]; Type dataRowType = e(dataRowClassName); if (dataRowType == null) { g("Can not get data row type with class name '{0}'.", dataRowClassName); return; } string dataTableNameInType = > 1 ? splitNames[1] : null; taTable(dataRowType, dataTableName, dataTableNameInType, aTableAsset(dataTableName, loadType), loadType, bleAsset, userData); } public static Color32 ParseColor32(string value) { string[] splitValue = (','); return new Color32((splitValue[0]), (splitValue[1]), (splitValue[2]), (splitValue[3])); } public static Color ParseColor(string value) { string[] splitValue = (','); return new Color((splitValue[0]), (splitValue[1]), (splitValue[2]), (splitValue[3])); } public static Quaternion ParseQuaternion(string value) {

string[] splitValue = (','); return new Quaternion((splitValue[0]), (splitValue[1]), (splitValue[2]), (splitValue[3])); } public static Rect ParseRect(string value) { string[] splitValue = (','); return new Rect((splitValue[0]), (splitValue[1]), (splitValue[2]), (splitValue[3])); } public static Vector2 ParseVector2(string value) { string[] splitValue = (','); return new Vector2((splitValue[0]), (splitValue[1])); } public static Vector3 ParseVector3(string value) { string[] splitValue = (','); return new Vector3((splitValue[0]), (splitValue[1]), (splitValue[2])); } public static Vector4 ParseVector4(string value) { string[] splitValue = (','); return new Vector4((splitValue[0]), (splitValue[1]), (splitValue[2]), (splitValue[3])); } }}