当前位置: 首页>>代码示例>>C#>>正文


C# Card.GetFaceValue方法代码示例

本文整理汇总了C#中Card.GetFaceValue方法的典型用法代码示例。如果您正苦于以下问题:C# Card.GetFaceValue方法的具体用法?C# Card.GetFaceValue怎么用?C# Card.GetFaceValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card.GetFaceValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Images

        /// <summary>
        /// Constructor - Loads images from disk files.
        /// </summary>
        static Images()
        {
            // 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 ...
        }
开发者ID:Lavinia01,项目名称:Solitaire---Crazy-Eights-Game,代码行数:17,代码来源:Images.cs

示例2: AddCardToPile

 /// <summary>
 /// It adds a card to the discard pile or to the draw pile.
 /// </summary>
 /// <param name="pile"></param>
 /// <param name="card"></param>
 public static void AddCardToPile(Pile pile, Card card)
 {
     if (pile == Pile.Discard)
     {
         discardPile.AddCard(card);
         if (card.GetFaceValue() != FaceValue.Eight)
         {
             current = card;
         }
     }
     else
     {
         drawPile.AddCard(card);
     }
 }
开发者ID:Lavinia01,项目名称:Solitaire---Crazy-Eights-Game,代码行数:20,代码来源:Crazy+Eight+Game.cs

示例3: ValidateSelection

 /// <summary>
 /// It validates the move of the previous code.
 /// </summary>
 /// <param name="card"></param>
 /// <returns>Return true if the card equals the current in its suit, facevalue or its facevalue is eight. Otherwise returns false.</returns>
 private static Boolean ValidateSelection(Card card)
 {
     if (current.GetFaceValue() == FaceValue.Eight && start)
     {
         start = false;
         return true;
     }
     else if (card.GetSuit() == current.GetSuit())
     {
         return true;
     }
     else if (card.GetFaceValue() == current.GetFaceValue())
     {
         return true;
     }
     else if (card.GetFaceValue() == FaceValue.Eight)
     {
         return true;
     }
     start = false;
     return false;
 }
开发者ID:Lavinia01,项目名称:Solitaire---Crazy-Eights-Game,代码行数:27,代码来源:Crazy+Eight+Game.cs

示例4: GetValueTest

        public void GetValueTest()
        {
            var suites = (Suite[])Enum.GetValues(typeof(Suite));
            var r1 = new Random().Next(1, 11);
            var s = suites[new Random().Next(0, suites.Length)];
            Card c = new Card(s, r1);
            Assert.AreEqual(r1.ToString(), c.GetFaceValue());

            c.Value = 11;
            Assert.AreEqual("Jack", c.GetFaceValue());

            c.Value = 12;
            Assert.AreEqual("Queen", c.GetFaceValue());

            c.Value = 13;
            Assert.AreEqual("King", c.GetFaceValue());
        }
开发者ID:raljoach,项目名称:Games,代码行数:17,代码来源:blackjacktest.cs

示例5: GetCardImageName

 /// <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);
 }
开发者ID:Lavinia01,项目名称:Solitaire---Crazy-Eights-Game,代码行数:9,代码来源:Images.cs

示例6: GetCardImage

 /// <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()];
 }
开发者ID:Lavinia01,项目名称:Solitaire---Crazy-Eights-Game,代码行数:9,代码来源:Images.cs


注:本文中的Card.GetFaceValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。