示例#1
0
        private void gameFieldPictureBox_MouseUp(object sender, MouseEventArgs e)
        {
            timer.Start();
            int x = e.X / Game.CellSize;
            int y = e.Y / Game.CellSize;

            if (!game.IsCellInGameField(x, y))
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                game.OpenCell(x, y);
            }

            if (e.Button == MouseButtons.Right)
            {
                game.MarkCell(x, y);
                if (game.FlagCount >= game.BombCount)
                {
                    bombCountLabel.Text = "Мин:" + 0;
                }
                else
                {
                    bombCountLabel.Text = "Мин:" + (game.BombCount - game.FlagCount);
                }
            }

            if (e.Button == MouseButtons.Middle ||
                smart == MouseButtons.Right && e.Button == MouseButtons.Left ||
                smart == MouseButtons.Left && e.Button == MouseButtons.Right)
            {
                game.SmartOpenCell(x, y);
            }
            gameFieldPictureBox.Refresh();
        }