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;
        }
Exemple #2
0
 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;
     //                }
     //            }
 }
Exemple #3
0
        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();
        }
 public SelectionControl(CurrentPlayer p)
     : this()
 {
     this.player = p;
 }
Exemple #5
0
 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;
 }