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


C# Circuit.Add方法代码示例

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


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

示例1: Load

        internal Game Load(string s, int humanPlayers)
        {
            int humans=0;
            Game game = Load(s);
            Circuit<Player> players = new Circuit<Player>();
            for (int i = 0; i < baricades.Count; i++)
            {
                baricades[i].Square.Piece = null;
                baricades[i].Square = null;
            }

            baricades = new List<BaricadePiece>();
            while (baricades.Count < baricadeSquares.Count)
            {
                BaricadePiece b = new BaricadePiece();
                baricadeSquares[baricades.Count].Piece = b;
                b.Square = baricadeSquares[baricades.Count];
                baricades.Add(b);
            }

            for(int i=0;i<game.Players.Count;i++)
            {
                Player p = game.Players.pop();
                for(int j=0;j<p.PlayerPawns.Count;j++)
                {
                    p.PlayerPawns[j].Square.removePawn(p.PlayerPawns[j]);
                }
                PlayerColor color = p.Color;
                int id = p.PlayerId;
                PlayerSquare square = p.PlayerSquare;

                if (humans < humanPlayers)
                {
                    p = new Player(players);
                    humans++;
                }
                else
                {
                    p = new AIPlayer(players);
                }
                p.PlayerSquare = square;
                p.PlayerId = id;
                p.Color = color;

                for (int j = 0; j < game.Board.NumberOfPawns; j++)
                {
                    p.addPawn(new Pawn(null,p));
                }
                players.Add(p);
            }
            game.Players = players;
            return game;
        }
开发者ID:spboom,项目名称:Baricade,代码行数:53,代码来源:Loader.cs

示例2: checkPlayers

 private void checkPlayers()
 {
     if (playerList.Count != playerSquares.Count)
     {
         playerList = new Circuit<Player>();
         for (int i = 0; i < playerSquares.Count; i++)
         {
             Player player = new Player(playerList);
             player.PlayerId = playerList.Count + 1;
             player.PlayerPawns = new List<Pawn>();
             player.PlayerSquare = playerSquares[i];
             switch (i+1)
             {
                 case 1:
                     player.Color = PlayerColor.Blue;
                     break;
                 case 2:
                     player.Color = PlayerColor.Green;
                     break;
                 case 3:
                     player.Color = PlayerColor.Red;
                     break;
                 case 4:
                     player.Color = PlayerColor.Yellow;
                     break;
             }
             for (int j = 0; j < NumberOfPawns; j++)
             {
                 player.PlayerPawns.Add(new Pawn(player.PlayerSquare, player));
             }
             playerList.Add(player);
         }
     }
 }
开发者ID:spboom,项目名称:Baricade,代码行数:34,代码来源:Loader.cs


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