public void CreateTas(ChessButton button, TasTipi tipi, bool renk) // Tahta Üzerinde Combobox dan seçilen taşı Oluşturur !! { if (button.Dolumu == false) { 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(); } else { MessageBox.Show("Zaten Bu Karede Bir Taş Var .."); } }
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; if (renk) { SiyahSah = sah; } if (!renk) { BeyazSah = sah; } 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(); }