コード例 #1
0
        private void _MouseUp(object sender, MouseEventArgs e)
        {
            if (kosacakmi == 1)
            {
                kostur();
                kosacakmi = 0;
            }
            tas[,] liste = new tas[14, 14];
            int satır = 0, sutun = 0;


            tas       t  = (tas)sender;
            int       x  = 170;
            int       y  = 340;
            Rectangle r1 = new Rectangle(t.Left, t.Top, 35, 50);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 15; j++)
                {
                    Rectangle r2 = new Rectangle(x, y, 35, 50);

                    if (r1.IntersectsWith(r2))
                    {
                        konumlar[i, j].KonumTas = t;
                        t.Left = x;
                        t.Top  = y;
                        //  MessageBox.Show("x :"+x+" y :"+y +"\n i :"+i +" j :"+j);
                        break;
                    }
                    x += 37;
                }
                x  = 170;
                y += 55;
            }
            if (t.Left < 50 && t.Top < 50)
            {
                ben.uyumlutassayisi = 0;
                for (int i = 0; i < 2; i++)
                {
                    for (int j = 0; j < 15; j++)
                    {
                        if (konumlar[i, j].KonumTas != null)
                        {
                            liste[satır, sutun] = konumlar[i, j].KonumTas;
                            sutun++;
                        }
                        else
                        {
                            if (sutun != 0)
                            {
                                satır++;
                                sutun = 0;
                            }
                        }
                    }
                }

                int [] dizi    = new int [14];
                int    yesler  = 0;
                int    kontrol = 0;
                int    perler  = 0;
                for (int i = 0; i < 14; i++)
                {
                    List <tas> per = new List <tas>();
                    for (int j = 0; j < 14; j++)
                    {
                        if (liste[i, j] != null)
                        {
                            per.Add(liste[i, j]);
                            //   MessageBox.Show("liste " + i + liste[i, j].Name);
                        }
                    }
                    perler++;
                    kontroller k    = new kontroller(ben);
                    int        bak1 = k.sirakontrol(per);
                    int        bak2 = k.renkkontrol(per);
                    if (bak1 == 1 || bak2 == 1)
                    {
                        kontrol = 1;
                    }
                    else
                    {
                        kontrol = -1;
                        break;
                    }
                }


                if (kontrol == -1)
                {
                    MessageBox.Show("Eliniz bitik Değil");
                    t.Left = 230;
                    t.Top  = 350;
                }
                else
                {
                    kontroller ek = new kontroller(ben);
                    ek.Bitir();
                }
            }



            surukleme     = false;//bırakma
            kPanel.Cursor = Cursors.SizeAll;
        }
コード例 #2
0
        public void tasoyna()
        {
            kontroller k = new kontroller(oyuncu);
            tascek     t = new tascek(oyuncu);
            tas        tas;
            int        h = 0;

            if (koyuncuonce.taslari.Count != 0)
            {
                tas = koyuncuonce.taslari[koyuncuonce.taslari.Count - 1];

                h = t.yararmikontrol(tas, oyuncu);
                if (h == 0)
                {
                    if (ortanca.taslari.Count == 0)
                    {
                        this.Close();
                        MessageBox.Show("Ortanın Taşları Bitti");
                        this.Close();
                    }
                    else
                    {
                        oyuncu.tascek(ortanca.taslari[0], ortanca, oyuncu);
                        for (int i = 0; i < oyuncu.taslari.Count - 1; i++)
                        {
                            oyuncu.taslari[i].esik = 0;
                        }
                        if (oyuncu == sistem1)
                        {
                            while (ortanca.taslari[0].Left < 600)
                            {
                                ortanca.taslari[0].Left += 2;
                            }
                        }
                        if (oyuncu == sistem2)
                        {
                            while (ortanca.taslari[0].Top > 75)
                            {
                                ortanca.taslari[0].Top -= 2;
                            }
                        }
                        if (oyuncu == sistem3)
                        {
                            while (ortanca.taslari[0].Left > 300)
                            {
                                ortanca.taslari[0].Left -= 2;
                            }
                        }


                        ıstakalık ı   = new ıstakalık(oyuncu);
                        int       hsd = ı.dos();

                        int sad = hsd;
                        ortanca.taslari[0].tasGosterilecekMi = true;
                        oyunpaneli.Controls.Remove(ortanca.taslari[0]);
                        ortataslar();


                        k.dusunenoyuncu(oyuncu);
                        bitmekontrolu bt       = new bitmekontrolu(oyuncu);
                        Boolean       bittinmi = bt.bitebilirmikontrol();
                        if (bittinmi == true)
                        {
                            Form3 f = new Form3();
                            MessageBox.Show(oyuncu.Adi + " " + oyuncu.Numara + " elini bitirdi");

                            f.Show();
                            this.Close();
                        }
                    }
                }
            }
            if (h != 0)
            {
                oyuncu.tascek(koyuncuonce.taslari[koyuncuonce.taslari.Count - 1], koyuncu, oyuncu);

                k.dusunenoyuncu(oyuncu);
                bitmekontrolu bt       = new bitmekontrolu(oyuncu);
                Boolean       bittinmi = bt.bitebilirmikontrol();
                if (bittinmi == true)
                {
                    Form3 f = new Form3();
                    MessageBox.Show(oyuncu.Adi + " " + oyuncu.Numara + " elini bitirdi");

                    f.Show();
                    this.Close();
                }
            }



            tasat tasat          = new tasat(oyuncu);
            tas   EnazYarayanTas = tasat.enazyarayantas();

            oyuncu.tasat(EnazYarayanTas, oyuncu, koyuncu);
        }