本文整理汇总了C#中Card.GetSuit方法的典型用法代码示例。如果您正苦于以下问题:C# Card.GetSuit方法的具体用法?C# Card.GetSuit怎么用?C# Card.GetSuit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card.GetSuit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: HasSameSuit
public bool HasSameSuit(Card another) {
return suit == another.GetSuit();
}
示例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: 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);
}
示例5: 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()];
}