示例#1
0
        /// <summary>
        /// Give a card to the dealer from the top of some deck (with animation)
        /// </summary>
        private void MoveCardToDealer()
        {
            cardtable.DrawOptions();

            int  nDeck;
            Card card = game.PopCardFromDeck(out nDeck);

            // Dealer can get busted or get a score of 21 after receiving new card (just like any player)
            try
            {
                game.GetDealer().TakeCard(card);
            }
            catch (BustException)
            {
                game.DealerBust = true;
            }
            catch (BlackjackException)
            {
                game.DealerBlackjack = true;
            }

            //Animate
            cardtable.DrawCard(card, nDeck);
            Thread.Sleep(300);

            cardtable.DrawShoes();
            cardtable.ShowDealerHand();

            cardtable.Invalidate();
        }
示例#2
0
 /// <summary>
 /// The method draws all cards in dealer's hand (shifted horizontally by 30 pixels)
 /// </summary>
 public void ShowDealerHand()
 {
     for (int i = 0; i < game.GetDealer().PlayerHand.GetCardsNumber(); i++)
     {
         g.DrawImage(cardImages[game.GetDealer().PlayerHand[i].getNumber()],
                     dealerCoords.X + 30 * i, dealerCoords.Y,
                     drawCardWidth, drawCardHeight);
     }
 }