Exemple #1
0
        private void CardClick(object sender, EventArgs e)
        {
            timer1.Start();
            if (cardFlag == 0)
            {
                firstCard       = (PictureBox)sender;
                cardFlag        = 1;
                firstCard.Image = new Bitmap(newGame.FindCardImage((int)firstCard.Tag));
            }
            else if (cardFlag == 1)
            {
                lastCard       = (PictureBox)sender;
                cardFlag       = 0;
                lastCard.Image = new Bitmap(newGame.FindCardImage((int)lastCard.Tag));
                if (changeGamer == 0)
                {
                    timerCounter = 5;
                    cardStatus   = newGame.CheckCard(gamer1, (int)firstCard.Tag, (int)lastCard.Tag);
                    if (cardStatus == 1)
                    {
                        firstCard.Visible = false;
                        lastCard.Visible  = false;
                    }
                }
                else if (changeGamer == 1)
                {
                    timerCounter = 5;
                    cardStatus   = newGame.CheckCard(gamer2, (int)firstCard.Tag, (int)lastCard.Tag);
                    if (cardStatus == 1)
                    {
                        firstCard.Visible = false;
                        lastCard.Visible  = false;
                    }
                }
                if (cardStatus == 0)
                {
                    firstCard.Visible = false;
                    lastCard.Visible  = false;
                    timer1.Stop();
                    lblGamer1.Text = "";

                    if (gamer1.Score >= gamer2.Score)
                    {
                        MessageBox.Show("Oyun Bitti...\nKazanan Oyuncu : " + gamer1.Name, "Win Win Win");
                    }
                    else
                    {
                        MessageBox.Show("Oyun Bitti...\nKazanan Oyuncu : " + gamer2.Name, "Win Win Win");
                    }
                }
                waitOneMiliSecond.Start();
            }
            lblGamer1.Text = gamer1.Name + " : " + gamer1.Score;
            lblGamer2.Text = gamer2.Name + " : " + gamer2.Score;
        }