コード例 #1
0
        private void singlePlay_Click(object sender, EventArgs e)
        {
            ButtonsBoard buttonsBoard = new ButtonsBoard(sp.carriers, sp.battleships, sp.destroyers, sp.submarines, sp.patrol, sp.color, sp.size);
            GamePanel    gp           = new GamePanel(buttonsBoard);

            gp.Show();
            // zaciagnij ustawienia z pliku i zrob panel w konstruktorze
        }
コード例 #2
0
 public GamePanel(ButtonsBoard buttonsBoard)
 {
     InitializeComponent();
     btns = buttonsBoard;
     this.Controls.Add(buttonsBoard.panel1);
     this.leaderboardPanel.Location = new Point(buttonsBoard.panel1.Width + 20, 0);
     this.Controls.Add(buttonsBoard.panel2);
     this.Size           = new System.Drawing.Size(buttonsBoard.panel1.Width * 2 + 200, buttonsBoard.panel1.Height + 50);
     this.BackColor      = buttonsBoard.color;
     historyTextBox.Size = new Size(100, buttonsBoard.panel1.Height / 4);
     this.ResumeLayout(false);
 }
コード例 #3
0
        public void EndGame(ButtonsBoard btns)
        {

            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(FormMain))
                {
                    fm = (FormMain)form;
                }
            }
            if (btns.roundEnded)
            {
                MessageBox.Show("Winner is " + btns.winner, "Round Ended",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
                btns.roundEnded = false;
                if (btns.winner == "AI") fm.aiScoreLabel.Text = (Convert.ToInt32(fm.aiScoreLabel.Text) + 1).ToString();
                if (btns.winner == "Player") fm.humanScoreLabel.Text = (Convert.ToInt32(fm.humanScoreLabel.Text) + 1).ToString();
                gPanel.Close();
            }
        }