예제 #1
0
        public void Step()
        {
            if (GameFld.Winner != 0)
            {
                return;
            }
            progressBar1.Visible = true;



            Rectangle rec = new Rectangle();

            for (int i = 0; i <= 2; i++)
            {
                for (int j = 0; j <= 2; j++)
                {
                    rec = (Rectangle)ListRect[i, j];

                    if (rec.Contains(pxd))
                    {
                        if (GameFld.field[i, j] != 0)
                        {
                            return;
                        }

                        GameFld.field[i, j] = 2;
                    }
                }
            }


            if (this.нормаToolStripMenuItem.CheckState == CheckState.Checked)
            {
                GameFld.diffic = 1;
            }
            if (this.жестьToolStripMenuItem.CheckState == CheckState.Checked)
            {
                GameFld.diffic = 2;
            }

            GameFld = AutoGamer.NextStep(GameFld);
            this.Fillfield(GameFld.field);
            this.Labeldraw();
        }
예제 #2
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            if (GameFld.Winner != 0)
            {
                return;
            }

            Point p = new Point(e.X, e.Y);


            Rectangle rec = new Rectangle();

            for (int i = 0; i <= 2; i++)
            {
                for (int j = 0; j <= 2; j++)
                {
                    rec = (Rectangle)ListRect[i, j];

                    if (rec.Contains(p))
                    {
                        if (GameFld.field[i, j] != 0)
                        {
                            return;
                        }

                        GameFld.field[i, j] = 2;
                    }
                }
            }


            if (this.нормаToolStripMenuItem.CheckState == CheckState.Checked)
            {
                GameFld.diffic = 1;
            }
            if (this.жестьToolStripMenuItem.CheckState == CheckState.Checked)
            {
                GameFld.diffic = 2;
            }

            GameFld = AutoGamer.NextStep(GameFld);
            this.Fillfield(GameFld.field);
            switch (GameFld.Winner)
            {
            case 1:
                txtNote.Text      = "Вы проиграли! Деньги на бочку!";
                txtNote.ForeColor = Color.Red;
                break;

            case 2:
                txtNote.Text      = "Вы выиграли, поздравляю!";;
                txtNote.ForeColor = Color.Green;
                break;

            case 0:
                txtNote.Text      = "Ваш ход...";
                txtNote.ForeColor = Color.Blue;
                int busycell = 0;
                for (int i = 0; i <= 2; i++)
                {
                    for (int j = 0; j <= 2; j++)
                    {
                        if (GameFld.field[i, j] != 0)
                        {
                            busycell++;
                        }
                    }
                }
                if (busycell == 9)
                {
                    txtNote.Text      = "Ничья вышла...";
                    txtNote.ForeColor = Color.Blue;
                }
                break;
            }


            //g.DrawImage(bitKreiz, rec);
            //this.pictureBox1.Invalidate();
        }