本文整理汇总了C#中CardColor类的典型用法代码示例。如果您正苦于以下问题:C# CardColor类的具体用法?C# CardColor怎么用?C# CardColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CardColor类属于命名空间,在下文中一共展示了CardColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Card
public Card(CardColor color, Shape shape, Fill fill, int count)
{
#region validation
if (color == CardColor.Other)
{
throw new InvalidCardException("color", color);
}
if (shape == Shape.Other)
{
throw new InvalidCardException("shape", shape);
}
if (fill == Fill.Other)
{
throw new InvalidCardException("fill", fill);
}
if (count > 3 || count < 1)
{
throw new InvalidCardException("count", count);
}
#endregion validation
this.Color = color;
this.Shape = shape;
this.Fill = fill;
this.Count = count;
}
示例2: GameResultCard
public GameResultCard(CardColor color, CardPosition position)
{
this.color = color;
this.position = position;
this.Init();
}
示例3: Card
//bool selected = false;
public Card(ContentManager cm, float scale, Point pos, CardColor cardColor, int cardID)
{
//Load content
backOfCard = cm.Load<Texture2D>("backofcard");
frameSheet = cm.Load<Texture2D>("frameSheet");
numberSheet = cm.Load<Texture2D>("numbers");
this.scale = scale;
hexWidth = (int)(backOfCard.Width);
hexHeight = (int)(backOfCard.Height);
radius = hexWidth / 2 * scale;
//Assign Numbers
this.cardColor = cardColor;
Tuple<byte, byte, byte> cardNumbers = CardNumbers(cardID);
TopNumber = cardNumbers.Item1;
LeftNumber = cardNumbers.Item2;
RightNumber = cardNumbers.Item3;
//Position Card Elements
drawRectangle = new Rectangle(0, 0, (int)(hexWidth * scale), (int)(hexHeight * scale));
drawRectangle.Location = pos;
frameRectangle = new Rectangle((int)cardColor * hexWidth, 0, hexWidth, hexHeight);
//This just defines the size of the draw rectangle for the numbers
topNumSource = new Rectangle(TopNumber * 18, 0, 18, 22);
leftNumSource = new Rectangle(LeftNumber * 18, 0, 18, 22);
rightNumSource = new Rectangle(RightNumber * 18, 0, 18, 22);
}
示例4: 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;
}
示例5: GetColorRank
protected static int GetColorRank(CardColor cardColor, ColorScore[] scores)
{
var i = 1;
foreach (var colorScore in scores.OrderByDescending(x => x.Score))
{
if (cardColor == colorScore.Color)
return i;
}
return scores.Length;
}
示例6: CardViewModel
public CardViewModel(Card card)
{
Card = card;
Colors = new CardColor[] {};
Update();
_timer = new Timer(delegate { Update(); }, null,
TimeSpan.FromMilliseconds(20),
TimeSpan.FromMilliseconds(20));
}
示例7: GenerateCards
public List<Card> GenerateCards()
{
List<Card> cards = new List<Card>();
CardColor[] validColors = new CardColor[] { CardColor.Green, CardColor.Purple, CardColor.Red };
Fill[] validFills = new Fill[] { Fill.Dashed, Fill.Open, Fill.Solid };
Shape[] validShapes = new Shape[] { Shape.Diamond, Shape.Oval, Shape.Squiggle };
int[] validCounts = new int[] { 1, 2, 3 };
foreach (CardColor color in validColors)
{
foreach (Fill fill in validFills)
{
foreach (Shape shape in validShapes)
{
foreach(int i in validCounts)
{
cards.Add(new Card(color, shape, fill, i));
}
}
}
}
return cards;
}
示例8: AddCardView
}// AddCard
protected CardView AddCardView(int player, CardColor col, int value){
CardView cv = null;
// Try to find a free one.
for (int i = 0; cv == null && i < _cardViewsPerPlayer [player].Count; i++) {
if (!_cardViewsPerPlayer [player] [i].gameObject.activeSelf)
cv = _cardViewsPerPlayer [player] [i];
}// for
if (cv != null) {
cv.SetCardColor (col);
cv.SetCardNumber (value);
cv.gameObject.SetActive (true);
} else {
cv = SpawnCard (
col,
value
);
int count = _cardViewsPerPlayer [player].Count;
int row = Mathf.FloorToInt (((float)count) / ((float)CardsMaxPerRow));
cv.transform.position =
//ParentPlayerHands[p].transform.position +
new Vector3 ((count % CardsMaxPerRow) * CardPlayerHandOffset.x, CardPlayerHandOffset.y, row * CardPlayerHandOffset.z);
cv.transform.rotation = Quaternion.Euler (CardPlayerHandRotation);// + ParentPlayerHands[p].transform.rotation.eulerAngles);
cv.transform.SetParent (ParentPlayerHands [player].transform, false);
cv.gameObject.name = "CardPlayer_" + player + "_" + count;
_cardViewsPerPlayer [player].Add (cv);
}// fi
return cv;
}// AddCardView
示例9: SpawnCard
}// AbortMatch
#endregion match management
#region view management
protected CardView SpawnCard(CardColor color, int value){
GameObject card = GameObject.Instantiate (PrefabCard);
CardView view = card.GetComponent<CardView> ();
view.SetCardColor (color);
view.SetCardNumber (value);
return view;
}// SpawnCard
示例10: GetCurrentMaxCardInColor
private Card GetCurrentMaxCardInColor( CardColor color )
{
Card maxCard = null;
CardComparer comparer = new CardComparer( _playingManager.CurrentAnnouncement.Type );
foreach ( Card card in _playingManager.RemainingCards )
{
if ( card.CardColor == color )
{
if ( maxCard == null )
{
maxCard = card;
}
if ( comparer.Compare( maxCard, card ) < 0 )
{
maxCard = card;
}
}
}
foreach ( Card card in _playingManager.CurrentHand )
{
if ( card.CardColor == color )
{
if ( maxCard == null )
{
maxCard = card;
}
if ( comparer.Compare( maxCard, card ) < 0 )
{
maxCard = card;
}
}
}
return maxCard;
}
示例11: DrawFourCard
private DrawFourCard(CardColor cc)
: base(cc, CardFace.DF)
{
}
示例12: HasColor
public bool HasColor(CardColor color)
{
return Effect().HasColor(color);
}
示例13: NumberCard
private NumberCard(CardColor cc, CardFace cf)
: base(cc, cf)
{
}
示例14: switch
protected override object this[string index]
{
get
{
#region
switch (index)
{
case "Id": return _id;
case "Name": return _name;
case "Color": return _color;
case "Value": return _value;
case "HeadIcon": return _headIcon;
default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
}
#endregion
}
set
{
#region
switch (index)
{
case "Id":
_id = value.ToInt();
break;
case "Name":
_name = value.ToNotNullString();
break;
case "Color":
_color = value.ToEnum<CardColor>();
break;
case "Value":
_value = value.ToShort();
break;
case "HeadIcon":
_headIcon = value.ToNotNullString();
break;
default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
}
#endregion
}
}
示例15: DrawTwoCard
private DrawTwoCard(CardColor cc)
: base(cc, CardFace.DT)
{
}