コード例 #1
0
ファイル: Deck.cs プロジェクト: GraemeLion/Deck
        public Deck()
        {
            for (int suit = 0; suit < 4; suit++) {
                for (int value = 1; value < 14; value++) {
                    var tmpCard = new Card ();
                    switch(suit)
                    {
                    case 0:
                        tmpCard.Suit = Suit.HEARTS;
                        break;
                    case 1:
                        tmpCard.Suit = Suit.CLUBS;
                        break;
                    case 2:
                        tmpCard.Suit = Suit.HEARTS;
                        break;
                    case 3:
                        tmpCard.Suit = Suit.SPADES;
                        break;

                    }

                    tmpCard.Value = value;
                    _deck.Add (tmpCard);

                }
            }
        }
コード例 #2
0
 public void ChangeTrumpCard(Card newCard)
 {
     this.trumpCard = newCard;
     if (this.listOfCards.Count > 0)
     {
         this.listOfCards[0] = newCard;
     }
 }
コード例 #3
0
        public Deck()
        {
            this.listOfCards = new List<Card>();
            foreach (var cardSuit in this.GetAllCardSuits())
            {
                foreach (var cardType in this.GetAllCardTypes())
                {
                    this.listOfCards.Add(new Card(cardSuit, cardType));
                }
            }

            this.listOfCards = this.listOfCards.Shuffle().ToList();

            this.trumpCard = listOfCards[0];
        }