コード例 #1
0
 public void TestInitPlayerCards()
 {
     DealerCardList = new List <CardDto>();
     //庄家和闲家各发两张牌
     //闲家
     for (int i = 0; i < 2; i++)
     {
         string  cardName = CardColor.GetString(1) + CardWeight21.GetString(1);
         CardDto card     = new CardDto(cardName, 1, 1);
         player.Add(card);
     }
     //庄家
     for (int i = 0; i < 2; i++)
     {
         CardDto card = libraryModel.Deal();
         DealerCardList.Add(card);
     }
 }
コード例 #2
0
 private void create(int CardsNum)
 {
     CardQueue = new Queue <Card>();
     while (CardsNum > 0)
     {
         //创建普通的牌
         for (int color = CardColor.CLUB; color <= CardColor.SQUARE; color++)
         {
             for (int weight = CardWeight21.ONE; weight <= CardWeight21.KING; weight++)
             {
                 string cardName = CardColor.GetString(color) + CardWeight21.GetString(weight);
                 Card   card     = new Card(cardName, color, weight);
                 //添加到 CardQueue  里面
                 CardQueue.Enqueue(card);
             }
         }
         CardsNum--;
     }
 }