예제 #1
0
        //if the click opens the second image of the pair
        //checking if the images in the opened pair are equal
        private void CheckIfEquals(int id)
        {
            image_b = id;
            //cannot be the same card
            if (image_a == image_b)
            {
                return;
            }

            play.ShowCard(image_b, cards[image_b]);

            if (cards[image_b] == cards[image_a])
            {
                Open(image_a);
                Open(image_b);
                done += 2;
                if (done == numberOfCards)
                {
                    play.Win();
                }
                else
                {
                    status = Status.INIT;
                }
            }
            else
            {
                status = Status.WRONG_ANS;
            }
        }