当前位置: 首页>>代码示例>>C#>>正文


C# Tokenizer.RequireNextInt方法代码示例

本文整理汇总了C#中Tokenizer.RequireNextInt方法的典型用法代码示例。如果您正苦于以下问题:C# Tokenizer.RequireNextInt方法的具体用法?C# Tokenizer.RequireNextInt怎么用?C# Tokenizer.RequireNextInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tokenizer的用法示例。


在下文中一共展示了Tokenizer.RequireNextInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseWall

    private Wall ParseWall(Tokenizer levelTokens)
    {
        levelTokens.EnsureNextToken("WALL");

        Wall wall = new Wall();

        levelTokens.EnsureNextToken("LEFT:");
        wall.V0 = levelTokens.RequireNextInt();
        levelTokens.EnsureNextToken("RIGHT:");
        wall.V1 = levelTokens.RequireNextInt();

        wall.TexMid = ParseWallTex("MID:", levelTokens, true);
        wall.TexTop = ParseWallTex("TOP:", levelTokens, true);
        wall.TexBottom = ParseWallTex("BOT:", levelTokens, true);
        wall.TexSign = ParseWallTex("SIGN:", levelTokens, false);

        levelTokens.EnsureNextToken("ADJOIN:");
        wall.Adjoin = levelTokens.RequireNextInt();

        levelTokens.EnsureNextToken("MIRROR:");
        wall.Mirror = levelTokens.RequireNextInt();

        levelTokens.EnsureNextToken("WALK:");
        wall.Walk = levelTokens.RequireNextInt();

        levelTokens.EnsureNextToken("FLAGS:");
        wall.Flags0 = (Wall.EFlags0)levelTokens.RequireNextInt();
        wall.Flags1 = levelTokens.RequireNextInt();
        wall.Flags2 = (Wall.EFlags2)levelTokens.RequireNextInt();

        levelTokens.EnsureNextToken("LIGHT:");
        wall.Light = levelTokens.RequireNextInt();

        return wall;
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:35,代码来源:LEV.cs

示例2: ParseWallTex

    private WallTex ParseWallTex(string name, Tokenizer levelTokens, bool trailing)
    {
        levelTokens.EnsureNextToken(name);

        WallTex tex = new WallTex();

        tex.Texture = levelTokens.RequireNextInt();
        tex.ShiftX = levelTokens.RequireNextFloat();
        tex.ShiftY = levelTokens.RequireNextFloat();

        if (trailing) {
            levelTokens.RequireNextInt();
        }

        return tex;
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:16,代码来源:LEV.cs

示例3: ParseTextures

    private void ParseTextures(Tokenizer levelTokens)
    {
        levelTokens.EnsureNextToken("TEXTURES");
        levelTokens.RequireNextInt();

        while (true) {
            if (levelTokens.IsNextToken("NUMSECTORS")) {
                levelTokens.RequireNextInt(); // eat sector count.
                break;
            }

            string texture = levelTokens.GetNextToken();
            _textures.Add(texture);
        }
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:15,代码来源:LEV.cs

示例4: ParseSectorWalls

    private void ParseSectorWalls(Sector sector, Tokenizer levelTokens)
    {
        levelTokens.EnsureNextToken("WALLS");

        int numWalls = levelTokens.RequireNextInt();

        for (int i = 0; i < numWalls; ++i) {
            Wall wall = ParseWall(levelTokens);
            if ((wall.Light + sector.Ambient) > 31) {
                wall.Light = 31 - sector.Ambient;
            } else if ((wall.Light + sector.Ambient) < 0) {
                wall.Light = -sector.Ambient;
            }

            sector.Walls.Add(wall);
        }
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:17,代码来源:LEV.cs

示例5: ParseSectorVertices

    private void ParseSectorVertices(Sector sector, Tokenizer levelTokens)
    {
        levelTokens.EnsureNextToken("VERTICES");

        int numVerts = levelTokens.RequireNextInt();

        for (int i = 0; i < numVerts; ++i) {
            Vector2 v;

            levelTokens.EnsureNextToken("X:");
            v.x = levelTokens.RequireNextFloat();
            levelTokens.EnsureNextToken("Z:");
            v.y = levelTokens.RequireNextFloat();

            sector.Vertices.Add(v);
        }
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:17,代码来源:LEV.cs

示例6: ParseSectors

    private void ParseSectors(Tokenizer levelTokens)
    {
        string token;
        while ((token = levelTokens.GetNextToken()) != null) {
            levelTokens.CheckThrow(token == "SECTOR", "Expected SECTOR!");
            levelTokens.RequireNextInt();

            Sector sector = ParseSectorHeader(levelTokens);
            ParseSectorVertices(sector, levelTokens);
            ParseSectorWalls(sector, levelTokens);
            Sectors.Add(sector);
        }
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:13,代码来源:LEV.cs

示例7: 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;
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:52,代码来源:LEV.cs


注:本文中的Tokenizer.RequireNextInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。