本文整理汇总了C#中CardFace类的典型用法代码示例。如果您正苦于以下问题:C# CardFace类的具体用法?C# CardFace怎么用?C# CardFace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CardFace类属于命名空间,在下文中一共展示了CardFace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Card
///////////////////////////////////////////////////////////////////////////////////////
// Constructors
///////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Construct a new card
/// </summary>
/// <param name="theColor"></param>
/// <param name="theFace"></param>
public Card(CardColor theColor, CardFace theFace)
{
// Check the card is value, otherwise throw a runtime error
if (!IsValidCard(theColor, theFace))
throw new Exception(CardColorToString(theColor) + " " + CardFaceToString(theFace) + " is not a valid Uno card");
// Save parameters in private attributes
color = theColor;
face = theFace;
}
示例2: Card
public Card(Image sourceImage, CardFace face)
{
SourceImage = sourceImage;
Face = face;
SourceImage.Projection = Projection;
SourceImage.Width = 200;
SourceImage.Height = 300;
SetImage("Back.png");
Storyboard.SetTarget(FlipAnimation, Projection);
Storyboard.SetTargetProperty(FlipAnimation, "RotationY");
FlipStoryboard.Children.Add(FlipAnimation);
}
示例3: AddEachColor
public static void AddEachColor(List<NumberCard> ec, CardFace cf, int amt, bool super)
{
while (amt > 0) {
ec.Add(new NumberCard(CardColor.Red, cf));
ec.Add(new NumberCard(CardColor.Green, cf));
ec.Add(new NumberCard(CardColor.Yellow, cf));
ec.Add(new NumberCard(CardColor.Blue, cf));
if (super) {
ec.Add(new NumberCard(CardColor.Orange, cf));
ec.Add(new NumberCard(CardColor.Purple, cf));
}
amt--;
}
}
示例4: CardFaceToString
private static string CardFaceToString(CardFace cardFace)
{
string result;
switch (cardFace)
{
case CardFace.Two:
result = "2";
break;
case CardFace.Three:
result = "3";
break;
case CardFace.Four:
result = "4";
break;
case CardFace.Five:
result = "5";
break;
case CardFace.Six:
result = "6";
break;
case CardFace.Seven:
result = "7";
break;
case CardFace.Eight:
result = "8";
break;
case CardFace.Nine:
result = "9";
break;
case CardFace.Ten:
result = "10";
break;
case CardFace.Jack:
result = "J";
break;
case CardFace.Queen:
result = "Q";
break;
case CardFace.King:
result = "K";
break;
case CardFace.Ace:
result = "A";
break;
default:
throw new ArgumentException(string.Format("Invalid value for card face : '{0}'.", cardFace));
}
return result;
}
示例5: CheckCardFace
private string CheckCardFace(CardFace cardFace)
{
string result = "";
if ((int)cardFace <= 10)
{
return result = ((int)cardFace).ToString();
}
else
{
string cardName = cardFace.ToString();
char firstLetter = cardName[0];
return result = firstLetter.ToString();
}
}
示例6: FaceToString
public static string FaceToString(CardFace cardType)
{
string cardTypeAsString = null;
switch (cardType)
{
case CardFace.Ace:
cardTypeAsString = "A";
break;
case CardFace.King:
cardTypeAsString = "K";
break;
case CardFace.Queen:
cardTypeAsString = "Q";
break;
case CardFace.Jack:
cardTypeAsString = "J";
break;
case CardFace.Ten:
cardTypeAsString = "10";
break;
case CardFace.Nine:
cardTypeAsString = "9";
break;
case CardFace.Eight:
cardTypeAsString = "8";
break;
case CardFace.Seven:
cardTypeAsString = "7";
break;
case CardFace.Six:
cardTypeAsString = "6";
break;
case CardFace.Five:
cardTypeAsString = "5";
break;
case CardFace.Four:
cardTypeAsString = "4";
break;
case CardFace.Three:
cardTypeAsString = "3";
break;
case CardFace.Two:
cardTypeAsString = "2";
break;
}
return cardTypeAsString;
}
示例7: IsTwoPairTestValid
public void IsTwoPairTestValid(CardFace face1, CardSuit suit1, CardFace face2, CardSuit suit2, CardFace face3, CardSuit suit3, CardFace face4, CardSuit suit4, CardFace face5, CardSuit suit5)
{
// Didn't found better way to implement many cards with NUnit
var cards = new List<ICard>()
{
new Card(face1, suit1),
new Card(face2, suit2),
new Card(face3, suit3),
new Card(face4, suit4),
new Card(face5, suit5),
};
var hand = new Hand(cards);
Assert.IsTrue(this.checker.IsOnePair(hand));
}
示例8: CreateCardButton
private CardButton CreateCardButton(CardFace f1, CardFace f2, bool suited)
{
CardButton button = new CardButton();
button.HoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
button.Selected = false;
button.SelectedColor = System.Drawing.Color.Yellow;
button.Size = new System.Drawing.Size(BUTTON_SIZE, BUTTON_SIZE);
button.TabIndex = 0;
String value;
if (suited) value = HoldemHand.ConvertToString(f1, CardSuit.Clubs, f2, CardSuit.Clubs);
else value = HoldemHand.ConvertToString(f1, CardSuit.Clubs, f2, CardSuit.Diamonds);
button.Name = "btn" + value;
button.Value = value;
return button;
}
示例9: CardFaceToChar
/* Helper method to convert a CardFace enum value into a char */
public static Char CardFaceToChar(CardFace c)
{
switch (c)
{
case CardFace.Ace: return 'A';
case CardFace.Two: return '2';
case CardFace.Three: return '3';
case CardFace.Four: return '4';
case CardFace.Five: return '5';
case CardFace.Six: return '6';
case CardFace.Seven: return '7';
case CardFace.Eight: return '8';
case CardFace.Nine: return '9';
case CardFace.Ten: return 'T';
case CardFace.Jack: return 'J';
case CardFace.Queen: return 'Q';
case CardFace.King: return 'K';
default:
Trace.Assert(false, "Invalid cardface detected during conversion to char: " + c);
return 'A'; // Never to be executed
}
}
示例10: FrontToBitmap
public Bitmap FrontToBitmap(CardSuit suit, CardFace face, Color color)
{
return this.FrontToBitmap(this.Size, suit, face, color);
}
示例11: DrawFront
public void DrawFront(Graphics g, int x, int y, int width, int height, CardSuit suit, CardFace face, bool inverted = false)
{
this.Draw(g, x, y, width, height, CardRenderer.GetCardIndex(suit, face), inverted ? CardType.InvertedFront : CardType.Front, Color.FromArgb(0));
}
示例12: ScoringValueForFace
/// <summary>
/// Get the Uno scoring value for a card face
/// </summary>
/// <param name="face">The face value of the card</param>
/// <returns>The integer value</returns>
public static int ScoringValueForFace(CardFace face)
{
int value = 0;
switch (face)
{
case CardFace.Zero:
case CardFace.One:
case CardFace.Two:
case CardFace.Three:
case CardFace.Four:
case CardFace.Five:
case CardFace.Six:
case CardFace.Seven:
case CardFace.Eight:
case CardFace.Nine:
value = CardFaceToInt(face);
break;
case CardFace.Draw2:
case CardFace.Reverse:
case CardFace.Skip:
value = 20;
break;
case CardFace.None:
case CardFace.Draw4:
value = 50;
break;
}
return value;
}
示例13: CountSameFacesOfCard
private static int CountSameFacesOfCard(IHand hand, CardFace face)
{
int countEqualFaces = 0;
foreach (var card in hand.Cards)
{
if (card.Face == face)
{
countEqualFaces++;
}
}
return countEqualFaces;
}
示例14: CardFaceToString
/// <summary>
/// Get the string representing the card face
/// </summary>
/// <param name="cardFace"></param>
/// <returns></returns>
public static string CardFaceToString(CardFace cardFace)
{
string ret = "";
switch (cardFace)
{
case CardFace.Zero:
case CardFace.One:
case CardFace.Two:
case CardFace.Three:
case CardFace.Four:
case CardFace.Five:
case CardFace.Six:
case CardFace.Seven:
case CardFace.Eight:
case CardFace.Nine:
ret = CardFaceToInt(cardFace).ToString();
break;
case CardFace.Draw2:
ret = "d2";
break;
case CardFace.Draw4:
ret = "d4";
break;
case CardFace.Reverse:
ret = "r";
break;
case CardFace.Skip:
ret = "s";
break;
}
return ret;
}
示例15: StringForCard
/// <summary>
/// Get the string for a card
/// </summary>
/// <param name="color"></param>
/// <param name="face"></param>
/// <returns></returns>
public static string StringForCard(CardColor color, CardFace face)
{
return CardColorToString(color) + CardFaceToString(face);
}