本文整理汇总了C#中Tokenizer.UngetToken方法的典型用法代码示例。如果您正苦于以下问题:C# Tokenizer.UngetToken方法的具体用法?C# Tokenizer.UngetToken怎么用?C# Tokenizer.UngetToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokenizer
的用法示例。
在下文中一共展示了Tokenizer.UngetToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSectorHeader
private Sector ParseSectorHeader(Tokenizer levelTokens)
{
Sector sector = new Sector();
levelTokens.EnsureNextToken("NAME");
string sectorName = levelTokens.GetNextToken();
if (sectorName != "AMBIENT") {
sector.Name = sectorName;
} else { // unnamed sector
levelTokens.UngetToken();
}
levelTokens.EnsureNextToken("AMBIENT");
sector.Ambient = levelTokens.RequireNextInt();
levelTokens.EnsureNextToken("FLOOR");
levelTokens.EnsureNextToken("TEXTURE");
sector.FloorTex = levelTokens.RequireNextInt();
sector.FloorShiftX = levelTokens.RequireNextFloat();
sector.FloorShiftZ = levelTokens.RequireNextFloat();
levelTokens.RequireNextInt();
levelTokens.EnsureNextToken("FLOOR");
levelTokens.EnsureNextToken("ALTITUDE");
sector.FloorAlt = -levelTokens.RequireNextFloat();
levelTokens.EnsureNextToken("CEILING");
levelTokens.EnsureNextToken("TEXTURE");
sector.CeilTex = levelTokens.RequireNextInt();
sector.CeilShiftX = levelTokens.RequireNextFloat();
sector.CeilShiftZ = levelTokens.RequireNextFloat();
levelTokens.RequireNextInt();
levelTokens.EnsureNextToken("CEILING");
levelTokens.EnsureNextToken("ALTITUDE");
sector.CeilAlt = -levelTokens.RequireNextFloat();
levelTokens.EnsureNextToken("SECOND");
levelTokens.EnsureNextToken("ALTITUDE");
sector.SecondAlt = -levelTokens.RequireNextFloat();
levelTokens.EnsureNextToken("FLAGS");
sector.Flags0 = (Sector.EFlags0)levelTokens.RequireNextInt();
sector.Flags1 = levelTokens.RequireNextInt();
sector.Flags2 = levelTokens.RequireNextInt();
levelTokens.EnsureNextToken("LAYER");
sector.Layer = levelTokens.RequireNextInt();
return sector;
}