當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。