Exemplo n.º 1
0
        private void FieldButtonClick(object sender, MouseEventArgs e)
        {
            FieldButton currentButton = (FieldButton)sender;

            //MessageBox.Show($"{currentButton.X} {currentButton.Y}");

            (int, int)sizeOfField = SelectSizeOfField();
            int sizeOfHigh  = sizeOfField.Item1;
            int sizeOfWidth = sizeOfField.Item2;

            logicGame = new LogicGame(2, sizeOfHigh, sizeOfWidth);

            logicGame.CapturingCell(1, currentButton.X, currentButton.Y);
        }
Exemplo n.º 2
0
        private void GameStart()
        {
            (int, int)sizeOfField = SelectSizeOfField();
            int sizeOfHigh  = sizeOfField.Item1;
            int sizeOfWidth = sizeOfField.Item2;



            fieldButtons = new FieldButton[sizeOfHigh, sizeOfWidth];
            for (int y = 0; y < sizeOfHigh; y++)
            {
                for (int x = 0; x < sizeOfWidth; x++)
                {
                    FieldButton btn = new FieldButton();
                    btn.Location = new Point(x * 40, y * 40 + 40);
                    btn.Size     = new Size(40, 40);
                    btn.X        = x;
                    btn.Y        = y;
                    Controls.Add(btn);
                    btn.MouseUp       += new MouseEventHandler(FieldButtonClick);
                    fieldButtons[y, x] = btn;
                }
            }
        }