private void StartGameButton_Click(object sender, EventArgs e)
        {
            if (SmallFigureRadioButton.Checked)
            {
                Figure.CUBE_SIZE = 10;
            }
            else if (MediumFigureRadioButton.Checked)
            {
                Figure.CUBE_SIZE = 20;
            }
            else if (BigFigureRadioButton.Checked)
            {
                Figure.CUBE_SIZE = 30;
            }
            else
            {
                Figure.CUBE_SIZE = 20;
            }

            Size = new Size(25 * Figure.CUBE_SIZE, 25 * Figure.CUBE_SIZE);

            tetrisGamePanel.Location = new Point(Figure.CUBE_SIZE, 10);
            tetrisGamePanel.Size     = new Size(10 * Figure.CUBE_SIZE, 20 * Figure.CUBE_SIZE);
            nextFigurePanel.Size     = new Size(5 * Figure.CUBE_SIZE, 5 * Figure.CUBE_SIZE);

            ScoreHeaderLabel.Location = new Point(tetrisGamePanel.Right + Figure.CUBE_SIZE, tetrisGamePanel.Top);
            ScoreHeaderLabel.Size     = new Size(5 * Figure.CUBE_SIZE, 2 * Figure.CUBE_SIZE);
            ScoreHeaderLabel.Font     = new Font("Microsoft Sans Serif", Figure.CUBE_SIZE);

            ScoreLabel.Location = new Point(ScoreHeaderLabel.Left, ScoreHeaderLabel.Bottom + 10);
            ScoreLabel.Size     = new Size(5 * Figure.CUBE_SIZE, 2 * Figure.CUBE_SIZE);
            ScoreLabel.Font     = new Font("Microsoft Sans Serif", Figure.CUBE_SIZE);
            ScoreLabel.Text     = gameScore.ToString();

            nextFigurePanel.Location = new Point(tetrisGamePanel.Right + Figure.CUBE_SIZE, ScoreLabel.Bottom + 20);

            tetrisGamePanelCanvas = tetrisGamePanel.CreateGraphics();
            nextFigurePanelCanvas = nextFigurePanel.CreateGraphics();

            tetrisGamePanel.Show();
            nextFigurePanel.Show();
            ScoreHeaderLabel.Show();

            StartGameButton.Enabled         = false;
            InfoButton.Enabled              = false;
            SmallFigureRadioButton.Enabled  = false;
            MediumFigureRadioButton.Enabled = false;
            BigFigureRadioButton.Enabled    = false;

            StartGameButton.Hide();
            InfoButton.Hide();
            FigureSizeLabel.Hide();
            SmallFigureRadioButton.Hide();
            MediumFigureRadioButton.Hide();
            BigFigureRadioButton.Hide();

            cubes = new List <KeyValuePair <Point, Brush> >();
            tetrisGamePanel.Invalidate();
            StartGame();
        }
Example #2
0
 private void StartGameButtonHandler(object sender, EventArgs e) //кнопка для начала игры
 {
     //скрытие всех начальных элементов формы
     StartGameButton.Hide();
     Ship1.Hide();
     Ship2.Hide();
     Ship3.Hide();
     Ship4.Hide();
     Ship5.Hide();
     Ship6.Hide();
     MartianBattleLabel.Hide();
     //определение управляющего объекта
     m_controlGame = new Controller(this, NumbersOfLives, Platform, new TextBox[] { Ship1, Ship2, Ship3, Ship4, Ship5, Ship6 });
     m_controlGame.StartGame(); //запуск игры
 }