示例#1
0
        public void ShowFace(Suit suit, int rank, WithAnimation animate)
        {
            _showingBack = false;

            if (animate == WithAnimation.Yes)
            {
                StartFlipAnimation(() => ShowFace(suit, rank, WithAnimation.No));
                return;
            }

            int x, y;

            if (rank <= 10)
            {
                x = (rank - 1) % 2;
                y = (rank - 1) / 2;

                switch (suit)
                {
                case Suit.Spades:
                    x += 6;
                    break;

                case Suit.Diamonds:
                    x += 2;
                    break;

                case Suit.Clubs:
                    x += 4;
                    break;
                }
            }
            else
            {
                int number = (rank - 11);
                switch (suit)
                {
                case Suit.Spades:
                    number += 6;
                    break;

                case Suit.Hearts:
                    number += 9;
                    break;

                case Suit.Diamonds:
                    number += 3;
                    break;
                }

                x = (number % 2) + 8;
                y = number / 2;
            }

            ClipImageToShowTheRightImage(x, y);
        }
示例#2
0
        public void ShowBack(WithAnimation animate)
        {
            _showingBack = true;

            if (animate == WithAnimation.Yes)
            {
                StartFlipAnimation(() => ShowBack(WithAnimation.No));
            }
            else
            {
                ClipImageToShowTheRightImage(7, 5);
            }
        }