コード例 #1
0
ファイル: SelectionControl.cs プロジェクト: cricket007/Blokus
        public void setup(CurrentPlayer player)
        {
            this.player = player;
            List<PieceControl> controls;
            int row = 0;
            int col = 0;

            controls = new List<PieceControl>(21);

            // Add the tiles from the player's hand to the control
            for (int i = 0; i < controls.Capacity && i < player.piecesLeft; i++, col++)
            {
                Tile piece = (Tile)player.hand[i];
                //                if (!piece.Equals(new Tile()))
                controls.Add(new PieceControl(player, piece));
                int xPoint = (col) * this.Width / 5;
                int yPoint = (row) * this.Height / 4;
                controls[i].Location = new System.Drawing.Point(xPoint, yPoint);
                controls[i].setup(this.player);
                controls[i].Size = new Size(80, 62);

                if (col > 3) // avoiding a nested for loop
                {
                    row++;
                    col = -1;
                }

                this.Controls.Add(controls[i]);

            }
            this.tiles = controls;
        }
コード例 #2
0
ファイル: BoardControl.cs プロジェクト: cricket007/Blokus
 public void setup(CurrentPlayer p, int turnNumber)
 {
     this.player = p;
     this._colorNum = turnNumber % 4;
     // TODO: Delete this
     //            int num = 0;
     //            for (int i = 0; i < matrx.width; i++)
     //            {
     //                for (int j = 0; j < matrx.height; j++)
     //                {
     //                    if (i >= 10)
     //                        num = 5;
     //                    if (i >= 12)
     //                        num = 6;
     //                    if (i >= 14)
     //                        num = 7;
     //                    if (i >= 16)
     //                        num = 8;
     //                    matrx[i][j] = num;
     //                }
     //            }
 }
コード例 #3
0
ファイル: BlokusGame.cs プロジェクト: cricket007/Blokus
        private void setup()
        {
            // Assign the current player and set the controls
            this.currentPlayer = players[0].convertToCurrentPlayer(pieceControl, pieceSelectControl);

            // PieceControls
            pieceControl.setup(currentPlayer);

            // NameTags
            currentPlayerControl.setup(currentPlayer);
            player2Control.setup(players[1]);
            player3Control.setup(players[2]);
            player4Control.setup(players[3]);

            // Board
            matrx.setup(currentPlayer, this.turn);
            matrx.Refresh();

            // Redraw the player's controls
            currentPlayer.refreshControls();
        }
コード例 #4
0
ファイル: SelectionControl.cs プロジェクト: cricket007/Blokus
 public SelectionControl(CurrentPlayer p)
     : this()
 {
     this.player = p;
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: cricket007/Blokus
 public CurrentPlayer convertToCurrentPlayer()
 {
     CurrentPlayer c = new CurrentPlayer();
     c.Name = this.Name;
     c.hand = this.hand;
     c.color = this.color;
     c.selectedPiece = this.selectedPiece;
     return c;
 }