コード例 #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--;
     }
 }
コード例 #3
0
        /// <summary>
        /// 创建牌
        /// </summary>
        private void create()
        {
            cardDtos = new Queue <CardDto>();
            for (int color = CardColor.CLUE; color <= CardColor.SQUARE; color++)
            {
                for (int weight = CardWeight.THREE; weight <= CardWeight.TWO; weight++)
                {
                    string  cardName = CardColor.GetString(color) + CardWeight.GetString(weight);
                    CardDto cardDto  = new CardDto(color, weight, cardName);
                    this.cardDtos.Enqueue(cardDto);
                }
            }
            //大王小王
            CardDto sJoker = new CardDto(CardColor.NONE, CardWeight.SJOKER, "SJoker");
            CardDto lJoker = new CardDto(CardColor.NONE, CardWeight.LJOKER, "LJoker");

            this.cardDtos.Enqueue(sJoker);
            this.cardDtos.Enqueue(lJoker);
        }
コード例 #4
0
ファイル: LibraryModel.cs プロジェクト: hjj0416/DouDiZhu
        private void Create()
        {
            cardQueue = new Queue <CardDto>();
            //创建普通的牌
            for (int color = CardColor.CLUB; color <= CardColor.SQUARE; color++)
            {
                for (int weight = CardWeight.THREE; weight <= CardWeight.TWO; weight++)
                {
                    string  cardName = CardColor.GetString(color) + CardWeight.GetString(weight);
                    CardDto card     = new CardDto(cardName, color, weight);
                    //添加到CardQuene里面
                    cardQueue.Enqueue(card);
                }
            }
            CardDto sJoker = new CardDto("SJoker", CardColor.NONE, CardWeight.SJOKER);
            CardDto lJoker = new CardDto("LJoker", CardColor.NONE, CardWeight.LJOKER);

            cardQueue.Enqueue(sJoker);
            cardQueue.Enqueue(lJoker);
        }