Exemplo n.º 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            TasTipi tip  = (TasTipi)cmb_tastipi.SelectedItem;
            bool    renk = cmb_renk.SelectedItem.ToString() == "Siyah" ? true : false; // turnary Kullandım Siyahsa True Beyazsa False Atayacak !

            CreateTas(Squares[Convert.ToInt32(txt_tahta_y.Text), Convert.ToInt32(txt_tahta_x.Text)], tip, renk);
        }
Exemplo n.º 2
0
        static public void CreateTas(ChessButton button, TasTipi tipi, bool renk) // Tahta Üzerinde Combobox dan seçilen taşı Oluşturur  !!
        {
            TasTipi tip = tipi;                                                   //(TasTipi)cmb_tastipi.SelectedItem


            switch (tip)
            {
            case TasTipi.Kale:
                Kale Kale = new Kale(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas    = Kale;
                button.Dolumu = true;
                MevcutTaslar.Add(Kale);
                break;

            case TasTipi.Sah:
                Sah sah = new Sah(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas = sah;
                MevcutTaslar.Add(sah);
                button.Dolumu = true;
                break;

            case TasTipi.Piyon:
                Piyon piyon = new Piyon(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas = piyon;
                MevcutTaslar.Add(piyon);
                button.Dolumu = true;
                break;

            case TasTipi.Fil:
                Fil fil = new Fil(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas = fil;
                MevcutTaslar.Add(fil);
                button.Dolumu = true;
                break;

            case TasTipi.At:
                At at = new At(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas = at;
                MevcutTaslar.Add(at);
                button.Dolumu = true;
                break;

            case TasTipi.Vezir:
                Vezir vezir = new Vezir(renk)
                {
                    TasKordinat = new Kordinat {
                        X = Convert.ToInt32(button.X), Y = Convert.ToInt32(button.Y)
                    }
                };
                button.Tas = vezir;
                MevcutTaslar.Add(vezir);
                button.Dolumu = true;
                break;
            }



            button.GetBackgroundİmage();
        }
Exemplo n.º 3
0
 public Tas(Renkler renk, int sayi, TasTipi tip)
 {
     Renk = renk;
     Sayi = sayi;
     Tip  = tip;
 }