本文整理汇总了C#中IGame.FindTableWithName方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.FindTableWithName方法的具体用法?C# IGame.FindTableWithName怎么用?C# IGame.FindTableWithName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.FindTableWithName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DislocatedComment
public DislocatedComment(IGame game, ISourceCode source, string comment, Library library, int offset)
{
int typeEnd = comment.IndexOf(' ');
if (typeEnd == -1)
{
throw new Exception("No type");
}
string type = comment.Substring(0, typeEnd);
FilePosition position = source.GetFilePosition(offset);
comment = comment.Substring(typeEnd + 1).TrimStart();
ISparkObject obj = null;
switch (type)
{
case "variable":
break;
case "function":
break;
case "userdata":
case "table":
case "class":
{
int tableNameEnd = comment.IndexOf('\n');
if (tableNameEnd == -1)
{
tableNameEnd = comment.Length;
}
string tableName = comment.Substring(0, tableNameEnd);
ITable table = game.FindTableWithName(tableName);
if (table == null)
{
table = new Table(tableName);
game.Tables.Add(table);
}
if (tableNameEnd < comment.Length)
{
comment = comment.Substring(tableNameEnd + 1).TrimStart();
}
else
{
comment = String.Empty;
}
obj = table;
break;
}
case "field":
{
int tableNameEnd = comment.IndexOf('.');
if (tableNameEnd == -1)
{
tableNameEnd = comment.Length;
}
string tableName = comment.Substring(0, tableNameEnd);
ITable table = game.FindTableWithName(tableName);
if (table == null)
{
table = new Table(tableName);
game.Tables.Add(table);
}
if (tableNameEnd < comment.Length)
{
comment = comment.Substring(tableNameEnd + 1).TrimStart();
}
else
{
comment = String.Empty;
}
int fieldNameEnd = comment.IndexOf("\n");
if (fieldNameEnd == -1)
{
fieldNameEnd = comment.Length;
}
string fieldName = comment.Substring(0, fieldNameEnd);
IField field = table.Fields.FirstOrDefault(x => x.Name == fieldName);
if (field == null)
{
field = new Field(table, fieldName);
table.Fields.Add(field);
}
if (fieldNameEnd < comment.Length)
{
comment = comment.Substring(fieldNameEnd + 1).TrimStart();
}
else
{
comment = String.Empty;
}
obj = field;
break;
}
case "staticfield":
{
int tableNameEnd = comment.IndexOf('.');
if (tableNameEnd == -1)
{
//.........这里部分代码省略.........