示例#1
0
        private void kkStartBtn_Click(object sender, EventArgs e)
        {
            if (usrInpA.Text.Trim().Length == 0 || usrInpB.Text.Trim().Length == 0)
            {
                MessageBox.Show("Podaj imiona graczy");
            }
            else
            {
                helloPanel.Visible = false;
                kkStartBtn.Visible = false;
                gamePanel.Visible  = true;
                panel1.Visible     = true;
                panel2.Visible     = true;
                panel3.Visible     = true;
                panel4.Visible     = true;

                turnA.Text = "O " + usrInpA.Text;
                turnB.Text = "X " + usrInpB.Text;

                game = new KK();

                if (game.whoMoves())
                {
                    turnA.Font = new Font(userLblA.Font, FontStyle.Bold);
                }
                else
                {
                    turnB.Font = new Font(userLblB.Font, FontStyle.Bold);
                }
            }
        }
示例#2
0
        private void restartBtn_Click(object sender, EventArgs e)
        {
            box00.Image = null;
            box01.Image = null;
            box02.Image = null;
            box10.Image = null;
            box20.Image = null;
            box11.Image = null;
            box21.Image = null;
            box12.Image = null;
            box22.Image = null;

            game = new KK();

            if (game.whoMoves())
            {
                turnA.Font = new Font(userLblA.Font, FontStyle.Bold);
                turnB.Font = new Font(userLblA.Font, FontStyle.Regular);
            }
            else
            {
                turnA.Font = new Font(userLblA.Font, FontStyle.Regular);
                turnB.Font = new Font(userLblB.Font, FontStyle.Bold);
            }

            gamePanel.Enabled = true;
        }