예제 #1
0
 public BattleBoard(PlayerSetupBoard pt, OpponentSetupBoard st, List <HashSet <Index> > playerBoatList, List <HashSet <Index> > opponentBoatList)
 {
     playerBoard   = new PlayerWarBoard(pt.Tiles);
     opponentBoard = new OpponentWarBoard(st.Tiles);
     setPlayerControls();
     playerListBoats        = playerBoatList;
     opponentListBoats      = opponentBoatList;
     opponentBoard.Location = st.Location;
     playerBoard.Location   = pt.Location;
     playerBoard.Enabled    = false;
     this.Controls.Add(playerBoard);
     this.Controls.Add(opponentBoard);
     l.Size      = new Size(900, 30);
     l.Location  = new Point(0, playerBoard.Height + 120);
     l.TextAlign = ContentAlignment.MiddleCenter;
     l.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Bold);
     l.ForeColor = Color.AntiqueWhite;
     this.Controls.Add(l);
     l.Text = "Cannons are ready, captain! Fire when ready!";
     playerBoard.setBattleBoard(this);
     opponentBoard.setBattleBoard(this);
     t.Interval = 400;
     t.Start();
     t.Tick          += tick;
     newGame.Size     = new Size(60, 50);
     newGame.Location = new Point(opponentBoard.Width + opponentBoard.Location.X - newGame.Width, playerBoard.Height + 105);
     newGame.Font     = new Font("Arial", 10, FontStyle.Italic);
     newGame.Text     = "New Game";
     this.Controls.Add(newGame);
     this.Controls[this.Controls.Count - 1].BringToFront();
     lbTitle.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Bold | FontStyle.Italic);
     lbTitle.Size      = new Size(550, 30);
     lbTitle.Location  = new Point(380, 10);
     lbTitle.Text      = "B A T T L E";
     lbTitle.ForeColor = Color.AntiqueWhite;
     this.Controls.Add(lbTitle);
     lbOpponent.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Italic | FontStyle.Bold);
     lbOpponent.Size      = new Size(150, 30);
     lbOpponent.Location  = new Point(140, 70);
     lbOpponent.Text      = "Your sea";
     lbOpponent.ForeColor = Color.AntiqueWhite;
     this.Controls.Add(lbOpponent);
     lbPlayer.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Italic | FontStyle.Bold);
     lbPlayer.Size      = new Size(250, 30);
     lbPlayer.Location  = new Point(opponentBoard.Location.X + 110, 70);
     lbPlayer.Text      = "Opponent sea";
     lbPlayer.ForeColor = Color.AntiqueWhite;
     lbPlayer.BackColor = Color.Transparent;
     this.Controls.Add(lbPlayer);
 }
        public setUpTwoPlayerBoard()
        {
            titleLabel.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Bold);
            titleLabel.ForeColor = Color.AntiqueWhite;
            titleLabel.Size      = new Size(550, 30);
            titleLabel.Location  = new Point(180, 10);
            titleLabel.Text      = "Welcome captain, prepare for battle";
            titleLabel.BackColor = Color.Transparent;
            this.Controls.Add(titleLabel);
            playerBoard          = new PlayerSetupBoard(3, 0);
            playerBoard.Location = new Point(5, 100);
            playerBoard.Click   += board_click;
            this.Controls.Add(playerBoard);
            opponentBoard          = new OpponentSetupBoard();
            opponentBoard.Location = new Point(500, 100);
            this.Controls.Add(opponentBoard);
            oLabel.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Italic | FontStyle.Bold);
            oLabel.ForeColor = Color.AntiqueWhite;
            oLabel.Size      = new Size(150, 30);
            oLabel.Location  = new Point(140, 70);
            oLabel.Text      = "Your sea";
            this.Controls.Add(oLabel);
            pLabel.Font      = new Font(new FontFamily("Arial"), 20, FontStyle.Italic | FontStyle.Bold);
            pLabel.ForeColor = Color.AntiqueWhite;
            pLabel.Size      = new Size(250, 30);
            pLabel.Location  = new Point(opponentBoard.Location.X + 110, 70);
            pLabel.Text      = "Opponent sea";
            this.Controls.Add(pLabel);
            threeBoats.Text        = "Destroyer";
            threeBoats.MouseClick += threeBoats_click;
            threeBoats.Location    = new Point(5, playerBoard.Height + 105);
            threeBoats.Size        = new Size(100, 50);
            threeBoats.Font        = new Font(new FontFamily("Arial"), 10, FontStyle.Bold);
            this.Controls.Add(threeBoats);
            fourBoats.Text        = "Battleship";
            fourBoats.MouseClick += fourBoats_click;
            fourBoats.Location    = new Point(threeBoats.Width + 5, playerBoard.Height + 105);
            fourBoats.Size        = new Size(100, 50);
            fourBoats.Font        = new Font(new FontFamily("Arial"), 10, FontStyle.Bold);
            this.Controls.Add(fourBoats);
            fiveBoats.Text        = "Aircraft carier";
            fiveBoats.MouseClick += fiveBoats_click;
            fiveBoats.Location    = new Point(threeBoats.Width + fourBoats.Width + 5, playerBoard.Height + 105);
            fiveBoats.Size        = new Size(100, 50);
            fiveBoats.Font        = new Font(new FontFamily("Arial"), 10, FontStyle.Bold);
            this.Controls.Add(fiveBoats);
            changeDir.Text        = "Change orientation";
            changeDir.MouseClick += changeDir_click;
            changeDir.Location    = new Point(threeBoats.Width + fourBoats.Width + fiveBoats.Width + 5, playerBoard.Height + 105);
            changeDir.Size        = new Size(100, 50);
            changeDir.Font        = new Font(new FontFamily("Arial"), 10, FontStyle.Bold);
            this.Controls.Add(changeDir);
            boatsLabel.Text      = "Ships left \n" + playerBoard.numBoatsOnTile[0];
            boatsLabel.ForeColor = Color.AntiqueWhite;
            boatsLabel.Location  = new Point(changeDir.Location.X + 105, changeDir.Location.Y + 10);
            boatsLabel.Font      = new Font(new FontFamily("Arial"), 10, FontStyle.Bold);
            boatsLabel.Size      = new Size(90, 50);
            Controls.Add(boatsLabel);
            startGame.Size     = new Size(400, 50);
            startGame.Location = new Point(opponentBoard.Location.X, playerBoard.Height + 105);
            startGame.Font     = new Font(new FontFamily("Arial"), 15, FontStyle.Bold | FontStyle.Italic);
            startGame.Text     = "START THE BATTLE";

            this.Controls.Add(startGame);
        }