Esempio n. 1
0
        /// <summary>
        /// Used by the constructor in this class only.  Do NOT use elsewhere.
        /// </summary>
        private static string GetCardImageName(Card card)
        {
            Suit      suit      = card.GetSuit();
            FaceValue faceValue = card.GetFaceValue();

            return(string.Format("{0}{1}", suit.ToString().TrimEnd('s'), faceValue));
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor - Loads images from disk files.
        /// </summary>
        static Images()
        {
            // Load coin images.
            heads = LoadImage("Coins", "Heads150");
            tails = LoadImage("Coins", "Tails150");

            // Load card images.
            backOfCardImage = Images.LoadImage("Cards", "CardBack_Red");
            cardImages      = new Bitmap[CardPile.NUM_SUITS, CardPile.NUM_CARDS_PER_SUIT];

            for (Suit suit = Suit.Clubs; suit <= Suit.Spades; suit++)
            {
                for (FaceValue faceValue = FaceValue.Two; faceValue <= FaceValue.Ace; faceValue++)
                {
                    Card   card          = new Card(suit, faceValue);
                    string cardImageName = GetCardImageName(card);
                    cardImages[(int)card.GetSuit(), (int)card.GetFaceValue()] = LoadImage("Cards", cardImageName);
                }
            } //end for ( Suit suit ...


            //Load die images
            dieImages = new Bitmap[7];

            for (int i = 1; i < dieImages.Length; i++)
            {
                string dieImageName = "Face_";
                dieImageName = dieImageName + i;
                dieImages[i] = LoadImage("Dice", dieImageName);
            }
        }//end Images
Esempio n. 3
0
 private void TryToPlayCard(Card clickedCard)
 {
     // This MessageBox is for debugging purposes only.
     //MessageBox.Show(clickedCard.ToString(false, true), "Clicked");
     UpdatePictureBoxImageRight(rightPictureBox, Crazy_Eight_Game.Check(clickedCard));
     if (clickedCard.GetFaceValue() == FaceValue.Eight)
     {
         Form Crazy_Eight = new WhatSuit();
         Crazy_Eight.Show();
     }
     DisplayGuiHand(Crazy_Eight_Game.GetHand(0), bottomTableLayoutPanel, 0);
 }
Esempio n. 4
0
 /// <summary>
 /// Returns the image for a given Card.
 /// </summary>
 /// <param name="card"></param>
 /// <returns>the image for the Card specified by the parameter.</returns>
 public static Bitmap GetCardImage(Card card)
 {
     return(cardImages[(int)card.GetSuit(), (int)card.GetFaceValue()]);
 }