Пример #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (towplayer == 1)
            {
                Form1 f1 = new Form1();
                f1.playernum = Form11.playernum;
                f1.colorplay = Form11.playernum;
                f1.fname     = Form11.fname;
                f1.lname     = Form11.lname;
                f1.date      = Form11.date;
                f1.Show();
            }
            else
            if (computerplye == 1)
            {
                if (radioButton1.Checked == true)
                {
                    Form8 f8 = new Form8();
                    level        = "easy";
                    f8.level     = level;
                    f8.playernum = Form11.playernum;
                    f8.colorplay = Form11.playernum;
                    f8.fname     = Form11.fname;
                    f8.lname     = Form11.lname;
                    f8.date      = Form11.date;

                    f8.Show();
                }
                else
                {
                    Form2 f2 = new Form2();
                    f2.playernum = Form11.playernum;
                    level        = "diffuclt";
                    f2.level     = level;
                    f2.colorplay = Form11.playernum;
                    f2.fname     = Form11.fname;
                    f2.lname     = Form11.lname;
                    f2.date      = Form11.date;
                    f2.Show();
                }
            }

            if (makegame == 1)
            {
                Form5 f5 = new Form5();
                Form1 f1 = new Form1();
                f5.playernum = Form11.playernum;
                f1.colorplay = Form11.playernum;
                f1.fname     = Form11.fname;
                f1.lname     = Form11.lname;
                f1.date      = Form11.date;
                f5.Show();
            }



            if (makegame == 0 && computerplye == 0 && towplayer == 0)
            {
                MessageBox.Show("Chose the type of game");
            }
        }
Пример #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int    i = e.RowIndex;
            int    id;
            string db = "\\chess.mdb";

            DataGridViewRow roww = dataGridView1.Rows[i];

            colorplay = int.Parse(roww.Cells[4].Value.ToString());
            if (playwithcomputer == false)
            {
                id = int.Parse(roww.Cells[3].Value.ToString());
            }
            else
            {
                id = int.Parse(roww.Cells[6].Value.ToString());
            }

            //label2.Text = id.ToString();
            if (playwithcomputer == false)
            {
                string sql1 = ("Select * from  gamepp" + " where id_gametowply =" + id + ";");
                getmat = Dbase.SelectFromTable(sql1, db).Rows[0][2].ToString();
                replaymat(getmat);
                timew   = Dbase.SelectFromTable(sql1, db).Rows[0][3].ToString();
                timw    = timew;
                timeb   = Dbase.SelectFromTable(sql1, db).Rows[0][4].ToString();
                timb    = timeb;
                gsteps  = Dbase.SelectFromTable(sql1, db).Rows[0][5].ToString();
                step2p  = gsteps;
                pacisew = Dbase.SelectFromTable(sql1, db).Rows[0][7].ToString();
                setpacess(pacisew, -1);
                pacieb = Dbase.SelectFromTable(sql1, db).Rows[0][8].ToString();
                setpacess(pacieb, 1);
                putmat.pushmat   = reeemat;
                putmat.check     = 1;
                putmat.pushpace  = pac;
                putmat.checkpace = 1;
                // label7.Text = "";
                // for(int y=0;y<putmat.pushpace.Length;y++)
                // label7.Text+= putmat.pushpace[y].ToString();
                Form1 f1 = new Form1();
                f1.Show();
                this.Hide();
            }
            else
            {
                string sql2 = ("Select * from hhh" + " where a =" + id + ";");
                level  = Dbase.SelectFromTable(sql2, db).Rows[0][2].ToString();
                getmat = Dbase.SelectFromTable(sql2, db).Rows[0][3].ToString();
                replaymat(getmat);
                timew   = Dbase.SelectFromTable(sql2, db).Rows[0][4].ToString();
                timw    = timew;
                timeb   = Dbase.SelectFromTable(sql2, db).Rows[0][5].ToString();
                timb    = timeb;
                gsteps  = Dbase.SelectFromTable(sql2, db).Rows[0][7].ToString();
                step1p  = gsteps;
                pacisew = Dbase.SelectFromTable(sql2, db).Rows[0][8].ToString();
                setpacess(pacisew, -1);
                pacieb = Dbase.SelectFromTable(sql2, db).Rows[0][9].ToString();
                setpacess(pacieb, 1);
                putmat.pushmat = reeemat;

                putmat.pushpace  = pac;
                putmat.checkpace = 2;
                if (level == "diffuclt")
                {
                    putmat.check = 3;
                    Form2 f2 = new Form2();
                    f2.Show();
                    this.Hide();
                }
                else
                {
                    putmat.check = 2;
                    Form8 f8 = new Form8();
                    f8.Show();
                    this.Hide();
                }
            }


            int[,] gg = new int[2, 16];
        }