// TODO - Switch Active Hand // TODO - Display Win/Lose/Draw Stats public void Draw(SpriteBatch spriteBatch) { //Draw Dealer Hand for (int i = 0; i < DealerHand.Count; i++) { if (_handState == HandState.PlayerTurn && i == 0) { //Draw the first Dealer card face down if it's the player's turn _cardDisplay.DrawCardBack(spriteBatch, 10 + (i * 30), 10); } else { _cardDisplay.DrawCard(spriteBatch, DealerHand[i], 10 + (i * 30), 10); } } //Draw Player Hand for (int j = 0; j < PlayerHands[0].Count; j++) { _cardDisplay.DrawCard(spriteBatch, PlayerHands[0][j], 10 + (j * 30), _height - 205); } //Draw Dealer Score string dealerHandValueDisplay = (_handState == HandState.PlayerTurn) ? "??" : DealerHand.HandValue.ToString(); _textDisplay.DrawString(spriteBatch, string.Format("Dealer Score: {0}", dealerHandValueDisplay), new Vector2(10, 200)); //Draw Player Score _textDisplay.DrawString(spriteBatch, string.Format("Player Score: {0}", PlayerHands[0].HandValue), new Vector2(10, 240)); //Draw Hand Indicator if (_currentHand == 0 && PlayerHands.Count > 1) { _textDisplay.DrawString(spriteBatch, "<<", new Vector2(250, 240)); } //Draw Split Hands if (PlayerHands.Count > 1) { for (int handIndex = 1; handIndex < PlayerHands.Count; handIndex++) // Start at the second Hand, the first has already been drawn { for (int cardIndex = 0; cardIndex < PlayerHands[handIndex].Count; cardIndex++) { _cardDisplay.DrawCardMiniature(spriteBatch, PlayerHands[handIndex][cardIndex], 275 + (150 * (handIndex - 1)) + (cardIndex * 15), _height - 205); _textDisplay.DrawString(spriteBatch, string.Format("{0}", PlayerHands[handIndex].HandValue), new Vector2(310 + (150 * (handIndex - 1)), _height - 80)); // Draw Hand Indicator if (handIndex == _currentHand && _handState == HandState.PlayerTurn) { _textDisplay.DrawString(spriteBatch, ">>", new Vector2(270 + (150 * (handIndex - 1)), _height - 80)); } } } } string handStateDisplay = ""; //Draw Hand State - Player Turn or Deal if (_handState == HandState.PlayerTurn) { handStateDisplay = "Player's Turn"; } else if (_handState == HandState.NoHand) { handStateDisplay = "Deal?"; } _textDisplay.DrawString(spriteBatch, handStateDisplay, new Vector2(250, 20)); //Draw Hand Result - Win Lose Draw string resultDisplay = ""; if (_handState == HandState.NoHand) { if (PlayerHands.Count > 1) { resultDisplay = "Splits!"; } else { switch (PlayerHands[0].Result) { case HandResult.Blackjack: resultDisplay = "Blackjack!"; break; case HandResult.Win: resultDisplay = "Player Wins"; break; case HandResult.Lose: resultDisplay = "Player Loses"; break; case HandResult.Draw: resultDisplay = "Player Ties"; break; default: break; } } _textDisplay.DrawString(spriteBatch, resultDisplay, new Vector2(250, 50)); } //Draw Chips _chipDisplay.DrawChip(spriteBatch, 650, 10, _playerChips); _textDisplay.DrawString(spriteBatch, string.Format("Bet: {0}", PlayerHands[0].HandBet), new Vector2(665, 140)); }
public void DrawChip(SpriteBatch spriteBatch, int xPosition, int yPosition, int amount) { DrawChip(spriteBatch, xPosition, yPosition); _textDisplay.DrawString(spriteBatch, amount.ToString(), new Vector2(xPosition + 30, yPosition + 47), Color.White); }