Example #1
0
 //handler for player A Ok button that adds the locations of ship into internalboard A object
 private void btnOk1_Click(object sender, EventArgs e)
 {
     btnBCreateBoard.Visible = true;
     btnBCreateBoard.Enabled = true;
     for (int row = 0; row < maxRows; row++)
     {
         for (int col = 0; col < maxCols; col++)
         {
             if (newButtonA[row, col].BackColor == Color.Purple ||
                 newButtonA[row, col].BackColor == Color.Yellow ||
                 newButtonA[row, col].BackColor == Color.Green ||
                 newButtonA[row, col].BackColor == Color.Black || newButtonA[row, col].BackColor == Color.Orange)
             {
                 PlayerABoard.shiplocationInsert(row, col);
             }
         }
     }
     lblLETTERS.Visible      = false;
     lblNumbers.Visible      = false;
     pnlPlayerA.Visible      = false;
     pnlBoatCreators.Visible = false;
     btnOk1.Enabled          = false;
     lblPlayerB.Visible      = true;
     txtPlayerB.Visible      = true;
 }
Example #2
0
 //handler for player two Ok button that adds the locations of ship into internalboard B object
 private void btnOk2_Click(object sender, EventArgs e)
 {
     for (int row = 0; row < maxRows; row++)
     {
         for (int col = 0; col < maxCols; col++)
         {
             if (newButtonB[row, col].BackColor == Color.Purple ||
                 newButtonB[row, col].BackColor == Color.Yellow ||
                 newButtonB[row, col].BackColor == Color.Green ||
                 newButtonB[row, col].BackColor == Color.Black || newButtonB[row, col].BackColor == Color.Orange)
             {
                 PlayerBBoard.shiplocationInsert(row, col);
             }
         }
     }
     lblLETTERSB.Visible    = false;
     lblNUMBERSB.Visible    = false;
     btnOk2.Enabled         = false;
     lblReady.Visible       = true;
     btnLetsplay.Visible    = true;
     pnlPlayerB.Visible     = false;
     pnlBuildShipsB.Visible = false;
 }