本文整理汇总了C#中CardCollection.First方法的典型用法代码示例。如果您正苦于以下问题:C# CardCollection.First方法的具体用法?C# CardCollection.First怎么用?C# CardCollection.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CardCollection
的用法示例。
在下文中一共展示了CardCollection.First方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupDeckAs
internal void SetupDeckAs(Player player)
{
CardCollection cards = new CardCollection(this.RetrieveCardsFrom(DeckLocation.Hand).Union(this.RetrieveCardsFrom(DeckLocation.Deck)));
foreach (Card sourceCard in player.Hand)
{
Card myFoundCard = cards.First(c => c.CardType == sourceCard.CardType);
cards.Remove(myFoundCard);
this.AddCardInto(DeckLocation.Hand, myFoundCard);
}
this.AddCardsInto(DeckLocation.Deck, cards);
}
示例2: GetListOfWinning
public Queue<Card> GetListOfWinning(IList<Card> currentHand, CardSuit suit, Queue<Card> q)
{
var currentSuitCards = new CardCollection
{
new Card(suit, CardType.Nine),
new Card(suit, CardType.Jack),
new Card(suit, CardType.Queen),
new Card(suit, CardType.King),
new Card(suit, CardType.Ten),
new Card(suit, CardType.Ace),
};
var cards = this.playedCardsInCurrentContext.Where(x => x.Suit == suit).ToList();
foreach (var card in cards)
{
currentSuitCards.Remove(card);
}
currentSuitCards.OrderByDescending(x => x.GetValue()).ToList();
if (currentSuitCards.Count() > 0)
{
if (currentHand.Contains(currentSuitCards.ElementAt(0)))
{
q.Enqueue(currentSuitCards.First());
}
}
return q;
}