コード例 #1
0
        public void Oyun(oyunForm form)
        {
            bilgisayar = new Bilgisayar(0, 0, "Bilgisayar");
            kullanıcı  = new Kullanıcı(1, 0, "Kullanıcı");

            rand           = new Random();
            futbolcular    = new Futbolcu[8];
            basketbolcular = new Basketbolcu[8];
            int s = 90;

            futbolcular[0] = new Futbolcu("DROGBA", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[1] = new Futbolcu("METIN OKTAY", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[2] = new Futbolcu("RONALDINHO", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[3] = new Futbolcu("HENRY", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[4] = new Futbolcu("ZLATAN", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[5] = new Futbolcu("BECKENBAUER", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[6] = new Futbolcu("HAGI", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);
            futbolcular[7] = new Futbolcu("XAVI", "FUTBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(1650, 370), new Size(210, 300), false, form);

            basketbolcular[0] = new Basketbolcu("DAVIS", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[1] = new Basketbolcu("SHAQ", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[2] = new Basketbolcu("KOBE", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[3] = new Basketbolcu("CURRY", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[4] = new Basketbolcu("JORDAN", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[5] = new Basketbolcu("CEDI OSMAN", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[6] = new Basketbolcu("HARDEN", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);
            basketbolcular[7] = new Basketbolcu("LEBRON", "BASKETBOL", rand.Next(s, 100), rand.Next(s, 100), rand.Next(s, 100), new Point(50, 370), new Size(210, 300), false, form);

            oyunForm.lblKul.Text = "Kullanıcı skoru : " + kullanıcı.GetSkor();
            oyunForm.lblPc.Text  = "Bilgisayar skoru : " + bilgisayar.GetSkor();
        }
コード例 #2
0
ファイル: Sporcu.cs プロジェクト: caglayan45/projeler
 public abstract Panel KartOlustur(Point konum, Size boyut, bool acikMi, int deger1, int deger2, int deger3, oyunForm form);
コード例 #3
0
        public override Panel KartOlustur(Point konum, Size boyut, bool acikMi, int deger1, int deger2, int deger3, oyunForm form)
        {
            Panel kart = new Panel();

            kart.Size     = boyut;
            kart.Location = konum;
            kart.BackgroundImageLayout = ImageLayout.Stretch;
            kart.AutoSizeMode          = AutoSizeMode.GrowOnly;

            Panel arkaPlan = new Panel();

            arkaPlan.Name = "arkaPlan";
            kart.Controls.Add(arkaPlan);
            arkaPlan.BackgroundImageLayout = ImageLayout.Stretch;
            arkaPlan.AutoSize = true;
            arkaPlan.Size     = kart.Size;
            arkaPlan.Visible  = false;

            Label isim = new Label();

            isim.Name      = "isim";
            isim.BackColor = Color.Transparent;
            isim.TextAlign = ContentAlignment.MiddleCenter;
            isim.ForeColor = Color.White;

            Label ozellik = new Label();

            ozellik.Name      = "ozellik";
            ozellik.BackColor = Color.Transparent;
            ozellik.ForeColor = Color.White;
            ozellik.TextAlign = ContentAlignment.MiddleCenter;

            isim.Width    = (kart.Width <= 105) ? 90 : 180;
            isim.Location = new Point(0, (kart.Height <= 150) ? 1 : 12);
            isim.Font     = new Font(FontFamily.GenericSansSerif, (kart.Width <= 105) ? 7.5f : 15.0f, FontStyle.Bold);

            ozellik.Width    = (kart.Width <= 105) ? 80 : 150;
            ozellik.Location = new Point((kart.Width <= 105) ? 5 : 10, (kart.Height <= 150) ? 118 : 245);
            ozellik.Font     = new Font(FontFamily.GenericSansSerif, (kart.Width <= 105) ? 5.0f : 6.7f, FontStyle.Bold);

            kart.Controls.Add(isim);
            kart.Controls.Add(ozellik);

            ozellik.Text = "UC: " + deger1 + " IKI: " + deger2 + " SRA: " + deger3;
            switch (base.sporcuIsim)
            {
            case "CEDI OSMAN":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\cedi.png");
                break;

            case "CURRY":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\cury.png");
                break;

            case "DAVIS":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\davis.png");
                break;

            case "HARDEN":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\harden.png");
                break;

            case "JORDAN":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\jordan.png");
                break;

            case "KOBE":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\kobe.png");
                break;

            case "LEBRON":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\lebron.png");
                break;

            case "SHAQ":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\basketbol\\shaq.png");
                break;

            default:
                break;
            }
            arkaPlan.BackgroundImage = Image.FromFile("resimler\\basketbol\\basketKartArka.png");
            if (acikMi)
            {
                arkaPlan.SendToBack();
                arkaPlan.Visible = false;
            }
            else
            {
                arkaPlan.BringToFront();
                arkaPlan.Visible = true;
            }
            kart.BringToFront();
            form.Controls.Add(kart);
            return(kart);
        }
コード例 #4
0
 public Basketbolcu(string adi, string takim, int ikilik, int ucluk, int serbestAtis, Point konum, Size boyut, bool acikMi, oyunForm form) : base(adi, takim)
 {
     sporcuIsim       = adi;
     sporcuTakim      = takim;
     oyuncuKarti      = KartOlustur(konum, boyut, acikMi, ucluk, ikilik, serbestAtis, form);
     this.ikilik      = ikilik;
     this.ucluk       = ucluk;
     this.serbestAtis = serbestAtis;
 }
コード例 #5
0
ファイル: Futbolcu.cs プロジェクト: caglayan45/projeler
        public override Panel KartOlustur(Point konum, Size boyut, bool acikMi, int deger1, int deger2, int deger3, oyunForm form)
        {
            Panel kart = new Panel();

            //KartOyunu.Form1.ActiveForm.Controls.Add(kart);

            kart.Size     = boyut;
            kart.Location = konum;
            kart.BackgroundImageLayout = ImageLayout.Stretch;
            kart.AutoSizeMode          = AutoSizeMode.GrowOnly;

            Panel arkaPlan = new Panel();

            arkaPlan.Name = "arkaPlan";
            kart.Controls.Add(arkaPlan);
            arkaPlan.BackgroundImageLayout = ImageLayout.Stretch;
            arkaPlan.AutoSize = true;
            arkaPlan.Size     = kart.Size;
            arkaPlan.Visible  = false;

            Label isim = new Label();

            isim.Name      = "isim";
            isim.BackColor = Color.Transparent;
            isim.TextAlign = ContentAlignment.MiddleCenter;
            isim.ForeColor = Color.White;

            Label ozellik = new Label();

            ozellik.Name      = "ozellik";
            ozellik.BackColor = Color.Transparent;
            ozellik.ForeColor = Color.White;
            ozellik.TextAlign = ContentAlignment.MiddleCenter;

            isim.Width    = (kart.Width <= 105) ? 90 : 180;
            isim.Location = new Point(0, (kart.Height <= 150) ? 1 : 12);
            isim.Font     = new Font(FontFamily.GenericSansSerif, (kart.Width <= 105) ? 7.5f : 15.0f, FontStyle.Bold);

            ozellik.Width    = (kart.Width <= 105) ? 80 : 150;
            ozellik.Location = new Point((kart.Width <= 105) ? 5 : 10, (kart.Height <= 150) ? 118 : 245);
            ozellik.Font     = new Font(FontFamily.GenericSansSerif, (kart.Width <= 105) ? 5.0f : 6.7f, FontStyle.Bold);

            kart.Name = base.sporcuTakim;
            kart.Controls.Add(isim);
            kart.Controls.Add(ozellik);
            ozellik.Text = "SRV: " + deger1 + " PEN: " + deger2 + " KKG: " + deger3;
            switch (base.sporcuIsim)
            {
            case "BECKENBAUER":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\beckenbauer.png");
                break;

            case "DROGBA":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\drogba.png");
                break;

            case "HAGI":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\hagi.png");
                break;

            case "HENRY":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\henry.png");
                break;

            case "METIN OKTAY":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\metinoktay.png");
                break;

            case "RONALDINHO":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\ronaldinho.png");
                break;

            case "XAVI":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\xavi.png");
                break;

            case "ZLATAN":
                isim.Text            = base.sporcuIsim;
                kart.BackgroundImage = Image.FromFile("resimler\\futbol\\zlatan.png");
                break;

            default:
                break;
            }
            arkaPlan.BackgroundImage = Image.FromFile("resimler\\futbol\\fulbolKartArka.png");
            if (acikMi)
            {
                arkaPlan.SendToBack();
                arkaPlan.Visible = false;
            }
            else
            {
                arkaPlan.BringToFront();
                arkaPlan.Visible = true;
            }
            kart.BringToFront();//bu ifin üzerine geçebilir kontrol et
            form.Controls.Add(kart);
            return(kart);
        }
コード例 #6
0
ファイル: Futbolcu.cs プロジェクト: caglayan45/projeler
 public Futbolcu(string adi, string takim, int penalti, int serbestAtis, int kaleciyleKarsiKarsiya, Point konum, Size boyut, bool acikMi, oyunForm form) : base(adi, takim)
 {
     sporcuIsim                 = adi;
     sporcuTakim                = takim;
     oyuncuKarti                = KartOlustur(konum, boyut, acikMi, serbestAtis, penalti, kaleciyleKarsiKarsiya, form);
     this.penalti               = penalti;
     this.serbestAtis           = serbestAtis;
     this.kaleciyleKarsiKarsiya = kaleciyleKarsiKarsiya;
 }