Exemple #1
0
        public string YonShorten(string longUrl, string customURL = "")
        {
            string link = string.Empty;

            using (WebClient wb = new WebClient())
            {
                NameValueCollection data = new NameValueCollection
                {
                    ["url"]  = longUrl,
                    ["wish"] = customURL
                };

                byte[] response         = wb.UploadValues("http://api.yon.ir", "POST", data);
                string responseInString = Encoding.UTF8.GetString(response);
                Yon    result           = JsonConvert.DeserializeObject <Yon>(responseInString);
                if (result.status)
                {
                    link = "http://yon.ir/" + result.output;
                }
                else
                {
                    Growl.Error("that custom URL is already taken");
                }
            }

            return(link);
        }
Exemple #2
0
 public GameSettings(int X, int Y, int Z, int L, bool M)
 {
     Genislik    = X;
     Yukseklik   = Y;
     HizSeviyesi = Z;
     Skor        = 0;
     Puanlar     = L;
     OyunBitti   = M;
     Yon         = Yon.Down;
 }
Exemple #3
0
        private void YonTusunaBasildi(Yon yon)
        {
            if (!OyunOynaniyorMu())
            {
                return;
            }
            if (yon == Yon.Asagi || yon == Yon.Yukari)
            {
                return;
            }

            _oyun.UcaksavariHareketEttir(yon);
        }
Exemple #4
0
 private void YeniO()
 {
     yem           = false;
     skor          = 0;
     yilan1        = new yilan();
     yonumuz       = new Yon(-10, 0);
     pb_yparcalari = new PictureBox[0];
     for (int i = 0; i < 3; i++)
     {
         Array.Resize(ref pb_yparcalari, pb_yparcalari.Length + 1);
         pb_yparcalari[i] = Pb_ekle();
     }
     timer1.Start();
     button1.Enabled = false;
 }
Exemple #5
0
        public void ilerle(Yon yon)
        {
            yonumuz = yon;
            if (yon._x == 0 && yon._y == 0)
            {
            }

            else
            {
                for (int i = yilan_parca.Length - 1; i > 0; i--)
                {
                    yilan_parca[i] = new Yparcalari(yilan_parca[i - 1].x_, yilan_parca[i - 1].y_);
                }
                yilan_parca[0] = new Yparcalari(yilan_parca[0].x_ + yon._x, yilan_parca[0].y_ + yon._y);
            }
        }
Exemple #6
0
        public bool HareketEttir(Yon yon)
        {
            switch (yon)
            {
            case Yon.Sag:
                if (Right + HareketMesafesi > HareketAlaniGenislik)
                {
                    Left = HareketAlaniGenislik - Width;
                    return(true);
                }
                Left += HareketMesafesi;
                break;

            case Yon.Sol:
                if (Left - HareketMesafesi < 0)
                {
                    Left = 0;
                    return(true);
                }
                Left -= HareketMesafesi;
                break;

            case Yon.Asagi:
                if (Bottom + HareketMesafesi > HareketAlaniYukseklik)
                {
                    Top = HareketAlaniYukseklik - Height;
                    return(true);
                }
                Top += HareketMesafesi;
                break;

            case Yon.Yukari:
                if (Top - HareketMesafesi < 0)
                {
                    Top = 0;
                    return(true);
                }
                Top -= HareketMesafesi;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(false);
        }
Exemple #7
0
        public void YonTespitEt(KeyEventArgs e)
        {
            if (yonDegisti)
            {
                return;
            }

            Yon eskiYon = yilaninYonu;



            if (yilaninYonu != Yon.YUKARI)
            {
                if (e.KeyCode == Keys.Down || e.KeyCode == Keys.S)
                {
                    yilaninYonu = Yon.ASAGI;
                }
            }
            if (yilaninYonu != Yon.SOL)
            {
                if (e.KeyCode == Keys.Right || e.KeyCode == Keys.D)
                {
                    yilaninYonu = Yon.SAG;
                }
            }
            if (yilaninYonu != Yon.SAG)
            {
                if (e.KeyCode == Keys.Left || e.KeyCode == Keys.A)
                {
                    yilaninYonu = Yon.SOL;
                }
            }
            if (yilaninYonu != Yon.ASAGI)
            {
                if (e.KeyCode == Keys.Up || e.KeyCode == Keys.W)
                {
                    yilaninYonu = Yon.YUKARI;
                }
            }

            if (eskiYon != yilaninYonu)
            {
                yonDegisti = true;
            }
        }
Exemple #8
0
 private void Form1_KeyDown_1(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Up || e.KeyCode == Keys.W)
     {
         yonumuz = new Yon(0, -10);
     }
     else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.S)
     {
         yonumuz = new Yon(0, 10);
     }
     else if (e.KeyCode == Keys.Left || e.KeyCode == Keys.A)
     {
         yonumuz = new Yon(-10, 0);
     }
     else if (e.KeyCode == Keys.Right || e.KeyCode == Keys.D)
     {
         yonumuz = new Yon(10, 0);
     }
 }
Exemple #9
0
        public void Talimat(string komutlar)
        {
            foreach (var komut in komutlar)
            {
                switch (komut)
                {
                case 'L': KorsanYon += 90; break;

                case 'R': KorsanYon -= 90; break;

                case 'M': HareketEt(); break;
                }
                if (PlatoDisindaMi())
                {
                    break;
                }
            }
            YonBelirle(KorsanYon);
        }
Exemple #10
0
        private void YonBelirle(Yon korsanYon)
        {
            int deger = (Convert.ToInt32(korsanYon)) % 360;

            if (Math.Abs(deger) == 0)
            {
                KorsanYon = Yon.E;
            }
            else if (deger == 90 || deger == -270)
            {
                KorsanYon = Yon.N;
            }
            else if (Math.Abs(deger) == 180)
            {
                KorsanYon = Yon.W;
            }
            else if (deger == -90 || deger == 270)
            {
                KorsanYon = Yon.S;
            }
        }
Exemple #11
0
        public override void HareketEt(Form1 frm)
        {
            Button kaleEskiKonum = ButonBul(frm);

            List <Yon> gidilebilecekYonler = GidilebilecekYonler();

            Random rnd = new Random();

            int gidilecekYonIndex = rnd.Next(0, gidilebilecekYonler.Count);
            Yon gidilecekYon      = gidilebilecekYonler[gidilecekYonIndex];

            var gidilebilecekButonlar = BuYondeGidilebilecekButonlar(gidilecekYon, frm);

            if (gidilebilecekButonlar.Count > 0)
            {
                kaleEskiKonum.Image = null;
                int deneme = gidilebilecekButonlar.Count;
                Konum = gidilebilecekButonlar[rnd.Next(0, deneme)];
                Button kaleYeniKonum = ButonBul(frm);

                ResimGuncelle(this, kaleYeniKonum);
            }
        }
Exemple #12
0
 public Korsan(IPlato korsanPlato, IPozisyon korsanPozisyon, Yon korsanYon)
 {
     KorsanPlato    = korsanPlato;
     KorsanPozisyon = korsanPozisyon;
     KorsanYon      = korsanYon;
 }
Exemple #13
0
 public void Haraket(Yon yon)
 {
     throw new System.NotImplementedException();
 }
Exemple #14
0
 public void UcaksavariHareketEttir(Yon yon)
 {
     _ucakSavar.HareketEttir(yon);
 }
Exemple #15
0
        public virtual List <int> BuYondeGidilebilecekButonlar(Yon yon, Form1 form)
        {
            List <int> gidilebilecekButonlar = new List <int>();

            if (yon == Yon.Sag)
            {
                // Konum üzerinden işlem yapılacağı için geçici bir değişkene atandı.
                int geciciKonum = Konum;

                // Mod alındı. Moda göre işlem yapılacak.
                int mod = geciciKonum % 8;

                // Mod sıfır olana kadar ilerle. Sıfırsa en sağdadır demektir.
                while (mod != 0)
                {
                    //Bir sonraki konuma geç.
                    geciciKonum = geciciKonum + 1;

                    //Yeni konumdaki buton değişkene atanıyor.
                    Button yeniKonumdakiButon = form.Controls.Find(("btn" + (geciciKonum).ToString()), true).FirstOrDefault() as Button;

                    //Bu konumdaki butonda başka bir nesne var mı? Yoksa listeye ekle.
                    if (yeniKonumdakiButon.Image == null)
                    {
                        gidilebilecekButonlar.Add(geciciKonum);
                    }
                    mod = geciciKonum % 8;
                }
            }
            else if (yon == Yon.Sol)
            {
                // Konum üzerinden işlem yapılacağı için geçici bir değişkene atandı.
                int geciciKonum = Konum;

                // Mod alındı. Moda göre işlem yapılacak.
                int mod = geciciKonum % 8;

                // Mod sıfır olana kadar sola git. Sıfırsa en sağdadır demektir.
                while (mod != 1)
                {
                    //Bir sonraki konuma geç.
                    geciciKonum = geciciKonum - 1;

                    //Yeni konumdaki buton değişkene atanıyor.
                    Button yeniKonumdakiButon = form.Controls.Find(("btn" + (geciciKonum).ToString()), true).FirstOrDefault() as Button;

                    //Bu konumdaki butonda başka bir nesne var mı? Yoksa listeye ekle.
                    if (yeniKonumdakiButon.Image == null)
                    {
                        gidilebilecekButonlar.Add(geciciKonum);
                    }
                    mod = geciciKonum % 8;
                }
            }
            else if (yon == Yon.Yukari)
            {
                // Konum üzerinden işlem yapılacağı için geçici bir değişkene atandı.
                int geciciKonum = Konum;

                while (geciciKonum > 8)
                {
                    geciciKonum = geciciKonum - 8;
                    //Yeni konumdaki buton değişkene atanıyor.
                    Button yeniKonumdakiButon = form.Controls.Find(("btn" + (geciciKonum).ToString()), true).FirstOrDefault() as Button;

                    //Bu konumdaki butonda başka bir nesne var mı? Yoksa listeye ekle.
                    if (yeniKonumdakiButon.Image == null)
                    {
                        gidilebilecekButonlar.Add(geciciKonum);
                    }
                }
            }
            else
            {
                // Konum üzerinden işlem yapılacağı için geçici bir değişkene atandı.
                int geciciKonum = Konum;

                while (geciciKonum < 57)
                {
                    geciciKonum = geciciKonum + 8;
                    //Yeni konumdaki buton değişkene atanıyor.
                    Button yeniKonumdakiButon = form.Controls.Find(("btn" + (geciciKonum).ToString()), true).FirstOrDefault() as Button;

                    //Bu konumdaki butonda başka bir nesne var mı? Yoksa listeye ekle.
                    if (yeniKonumdakiButon.Image == null)
                    {
                        gidilebilecekButonlar.Add(geciciKonum);
                    }
                }
            }

            return(gidilebilecekButonlar);
        }