示例#1
0
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            butonOlustur();

            puanGetir();


            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += (s, e) =>
            {
                saniye       = saniye - 1;
                sureTxt.Text = saniye.ToString();
                if (saniye == 0)
                {
                    timer.Stop();
                    bittiTxt.Text           = "Süreniz Bitti!";
                    bittiTxt.Visibility     = Visibility.Visible;
                    sureRecBitti.Visibility = Visibility.Visible;
                    YCStoryboard.Begin();
                }
            };
        }
示例#2
0
        private void btnClick_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // TODO: Add event handler implementation here.
            butonTiklandi++;
            if (butonTiklandi == 1)   //ilk buton tıklandığında normal süreyi başlat
            {
                timer.Start();
            }

            Button button = sender as Button;        //hangi buton tıklanmış

            Grid   btngr    = button.Parent as Grid; //tıklanılan butonun bulunduğu grid
            String gridname = btngr.Name;            //tespit edilen gridin ismini stringe at



            if (button != null)
            {
                switch (button.Tag.ToString())//buton tag ı kontrolü
                {
                case "1":
                    kontrol = kontrol + 1;            //tıklama sayısı
                    resimidDizi[kontrol - 1] = "r11"; //attığımız resimlerin yerlerini diziye atıyoruz ki eşleştirmelerde kontrol etmek için

                    img1.Source = new BitmapImage(new Uri("troller/t1.png", UriKind.RelativeOrAbsolute));
                    img1.Height = 100;
                    img1.Width  = 100;

                    btngr.Children.Add(img1);

                    if (kontrol == 2)     //ikinci buton tıklandıysa
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;      //sureRec2 yi görünür yap (1 saniyelik) tıklamalar iptal
                        resimtimer.Interval = TimeSpan.FromSeconds(1); //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;     // 1saniyelik bekleme için

                            if (sa == 0)     //1 saniye geçtiğinde
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;     //tıklamalar yine aktif
                            }
                        };
                    }
                    //hresim.Children.Add(img1);
                    break;

                case "2":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r21";

                    img2.Source = new BitmapImage(new Uri("troller/t2.png", UriKind.RelativeOrAbsolute));
                    img2.Height = 100;
                    img2.Width  = 100;

                    btngr.Children.Add(img2);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "3":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r31";

                    img3.Source = new BitmapImage(new Uri("troller/t3.png", UriKind.RelativeOrAbsolute));
                    img3.Height = 100;
                    img3.Width  = 100;

                    btngr.Children.Add(img3);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "4":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r41";

                    img4.Source = new BitmapImage(new Uri("troller/t4.png", UriKind.RelativeOrAbsolute));
                    img4.Height = 100;
                    img4.Width  = 100;

                    btngr.Children.Add(img4);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "5":

                    img5.Source = new BitmapImage(new Uri("troller/kizgintroll.png", UriKind.RelativeOrAbsolute));
                    img5.Height = 100;
                    img5.Width  = 100;
                    timer.Stop();
                    btngr.Children.Add(img5);
                    sureRec2.Visibility = Visibility.Collapsed;
                    bittiTxt.Text       = "Kızgın Trolle yakalandınız!";
                    bittiTxt.Visibility = Visibility.Visible;
                    sureRec.Visibility  = Visibility.Visible;
                    YCStoryboard.Begin();



                    break;

                case "6":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r12";

                    img6.Source = new BitmapImage(new Uri("troller/t1.png", UriKind.RelativeOrAbsolute));
                    img6.Height = 100;
                    img6.Width  = 100;

                    btngr.Children.Add(img6);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "7":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r22";

                    img7.Source = new BitmapImage(new Uri("troller/t2.png", UriKind.RelativeOrAbsolute));
                    img7.Height = 100;
                    img7.Width  = 100;

                    btngr.Children.Add(img7);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "8":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r32";

                    img8.Source = new BitmapImage(new Uri("troller/t3.png", UriKind.RelativeOrAbsolute));
                    img8.Height = 100;
                    img8.Width  = 100;

                    btngr.Children.Add(img8);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "9":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r42";

                    img9.Source = new BitmapImage(new Uri("troller/t4.png", UriKind.RelativeOrAbsolute));
                    img9.Height = 100;
                    img9.Width  = 100;

                    btngr.Children.Add(img9);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "10":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r51";

                    img10.Source = new BitmapImage(new Uri("troller/t5.png", UriKind.RelativeOrAbsolute));
                    img10.Height = 100;
                    img10.Width  = 100;

                    btngr.Children.Add(img10);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "11":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r52";

                    img11.Source = new BitmapImage(new Uri("troller/t5.png", UriKind.RelativeOrAbsolute));
                    img11.Height = 100;
                    img11.Width  = 100;

                    btngr.Children.Add(img11);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "12":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r61";

                    img12.Source = new BitmapImage(new Uri("troller/t6.png", UriKind.RelativeOrAbsolute));
                    img12.Height = 100;
                    img12.Width  = 100;

                    btngr.Children.Add(img12);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "13":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r62";

                    img13.Source = new BitmapImage(new Uri("troller/t6.png", UriKind.RelativeOrAbsolute));
                    img13.Height = 100;
                    img13.Width  = 100;

                    btngr.Children.Add(img13);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "14":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r71";

                    img14.Source = new BitmapImage(new Uri("troller/t7.png", UriKind.RelativeOrAbsolute));
                    img14.Height = 100;
                    img14.Width  = 100;

                    btngr.Children.Add(img14);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "15":
                    kontrol = kontrol + 1;
                    resimidDizi[kontrol - 1] = "r72";

                    img15.Source = new BitmapImage(new Uri("troller/t7.png", UriKind.RelativeOrAbsolute));
                    img15.Height = 100;
                    img15.Width  = 100;

                    btngr.Children.Add(img15);

                    if (kontrol == 2)
                    {
                        sa = 1;
                        sureRec2.Visibility = Visibility.Visible;
                        resimtimer.Interval = TimeSpan.FromSeconds(1);     //resim geciktirme
                        resimtimer.Start();
                        resimtimer.Tick += (s, es) =>
                        {
                            sa = sa - 1;

                            if (sa == 0)
                            {
                                resimtimer.Stop();
                                resimKontrol();
                                sureRec2.Visibility = Visibility.Collapsed;
                            }
                        };
                    }
                    break;

                case "16":

                    img16.Source = new BitmapImage(new Uri("troller/kizgintroll.png", UriKind.RelativeOrAbsolute));
                    img16.Height = 100;
                    img16.Width  = 100;

                    btngr.Children.Add(img16);
                    timer.Stop();
                    sureRec2.Visibility = Visibility.Collapsed;

                    bittiTxt.Text           = "Kızgın Trolle yakalandınız!";
                    bittiTxt.Visibility     = Visibility.Visible;
                    sureRecBitti.Visibility = Visibility.Visible;
                    YCStoryboard.Begin();

                    break;
                }
            }
        }
示例#3
0
        private void resimKontrol()
        {
            kontrol = 0;

            Grid img1grid  = img1.Parent as Grid;
            Grid img2grid  = img2.Parent as Grid;
            Grid img3grid  = img3.Parent as Grid;
            Grid img4grid  = img4.Parent as Grid;
            Grid img5grid  = img5.Parent as Grid;
            Grid img6grid  = img6.Parent as Grid;
            Grid img7grid  = img7.Parent as Grid;
            Grid img8grid  = img8.Parent as Grid;
            Grid img9grid  = img9.Parent as Grid;
            Grid img10grid = img10.Parent as Grid;
            Grid img11grid = img11.Parent as Grid;
            Grid img12grid = img12.Parent as Grid;
            Grid img13grid = img13.Parent as Grid;
            Grid img14grid = img14.Parent as Grid;
            Grid img15grid = img15.Parent as Grid;
            Grid img16grid = img16.Parent as Grid;

            if (resimidDizi[0].Substring(0, 2) != resimidDizi[1].Substring(0, 2))         //açılan 2 resim eşit değilse
            {
                //açılan resimleri bul ve kaldır
                for (int i = 0; i < 2; i++)
                {
                    switch (resimidDizi[i])
                    {
                    case "r11":

                        img1grid.Children.Remove(img1);
                        break;

                    case "r21":

                        img2grid.Children.Remove(img2);
                        break;

                    case "r31":

                        img3grid.Children.Remove(img3);
                        break;

                    case "r41":

                        img4grid.Children.Remove(img4);
                        break;
                    //case "kizgin1":
                    //    img5grid.Children.Remove(img5);
                    //    break;

                    //case "kizgin2":
                    //    img16grid.Children.Remove(img16);
                    //    break;
                    case "r12":

                        img6grid.Children.Remove(img6);
                        break;

                    case "r22":

                        img7grid.Children.Remove(img7);
                        break;

                    case "r32":

                        img8grid.Children.Remove(img8);
                        break;

                    case "r42":

                        img9grid.Children.Remove(img9);
                        break;

                    case "r51":

                        img10grid.Children.Remove(img10);
                        break;

                    case "r52":

                        img11grid.Children.Remove(img11);
                        break;

                    case "r61":

                        img12grid.Children.Remove(img12);
                        break;

                    case "r62":

                        img13grid.Children.Remove(img13);
                        break;

                    case "r71":

                        img14grid.Children.Remove(img14);
                        break;

                    case "r72":

                        img15grid.Children.Remove(img15);
                        break;
                    }
                }
            }
            else                     //açılan 2 resim eşitse
            {
                acilanCift++;        //açılan çiftleri say
                if (acilanCift == 7) //açılan çift sayısı 7 ye ulaştığında oyun bitmiştir
                {
                    timer.Stop();
                    bittiTxt.Text = "Tebrikler !";
                    int yeniSkor = (60 - Convert.ToInt32(sureTxt.Text)) + 1;         //yeni skorurumuzu hesaplıyoruz
                    bittiTxt2.Text          = yeniSkor.ToString() + " saniyede tamamladınız.";
                    bittiTxt2.Visibility    = Visibility.Visible;
                    bittiTxt.Visibility     = Visibility.Visible;
                    sureRecBitti.Visibility = Visibility.Visible;
                    YCStoryboard.Begin();                                               //bitiş animasyonumuzu çağırıyoruz

                    if (enyuksekTxt.Text == "...")                                      //daha önce oynanmamışsa
                    {
                        IsolatedStorageSettings.ApplicationSettings["puan"] = yeniSkor; //puan isimli IsolatedStroge a yeniSkor u atıyoruz
                        IsolatedStorageSettings.ApplicationSettings.Save();
                        enyuksekTxt.Text = yeniSkor.ToString();
                    }
                    else                                                  //daha önceden skor kaydımız varsa
                    {
                        if (yeniSkor > Convert.ToInt32(enyuksekTxt.Text)) //ve skor kaydımız yeniSkor dan düşükse
                        {
                            IsolatedStorageSettings.ApplicationSettings["puan"] = yeniSkor;
                            IsolatedStorageSettings.ApplicationSettings.Save();
                            enyuksekTxt.Text = yeniSkor.ToString();
                        }
                    }
                }
            }
        }