Exemple #1
0
 public void startGame()
 {
     battleBoard                = new BattleBoard(setUp.playerBoard, setUp.opponentBoard, setUp.playerBoard.getBoatList(), setUp.opponentBoard.getListOfBoats());
     battleBoard.Location       = new System.Drawing.Point(0, 0);
     battleBoard.Height         = this.Height;
     battleBoard.Width          = this.Width;
     battleBoard.newGame.Click += newGame_click;
     this.Controls.Add(battleBoard);
     if (setUp != null)
     {
         setUp.Dispose();
     }
 }
Exemple #2
0
 private void newGame_click(object sender, EventArgs e)
 {
     if (firstStart)
     {
         firstStart     = false;
         gameInProgress = true;
         p.Hide();
         continueGame.Location = new System.Drawing.Point(newGame.Location.X, newGame.Location.Y + 30);
         continueGame.Size     = new System.Drawing.Size(300, 50);
         continueGame.Font     = new Font("Arial", 20, FontStyle.Italic | FontStyle.Bold);
         continueGame.Text     = "Continue Game";
         continueGame.Click   += continueGame_click;
         p.Controls.Add(continueGame);
         newGame.Location  = new System.Drawing.Point(newGame.Location.X, newGame.Location.Y + 90);
         exitGame.Location = new System.Drawing.Point(exitGame.Location.X, exitGame.Location.Y + 90);
         btnInfo.Location  = new System.Drawing.Point(btnInfo.Location.X, btnInfo.Location.Y + 90);
     }
     else
     {
         if (gameInProgress && battleBoard != null)
         {
             battleBoard.newGame.PerformClick();
             p.Hide();
             keyPressed = false;
         }
         else
         {
             keyPressed = false;
             if (setUp != null)
             {
                 setUp.Dispose();
             }
             startSetup();
             p.Hide();
         }
     }
 }