本文整理汇总了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 ...
}
示例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);
}
}
示例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;
}
示例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());
}
示例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);
}
示例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()];
}