/// <summary>
        /// Deals the specified hands.
        /// </summary>
        /// <param name="hands">The hands.</param>
        /// <param name="cardsInHand">The cards in hand.</param>
        public void Deal(Hand[] hands, int cardsInHand)
        {
            if (hands.Length * cardsInHand > this._numCards)
            {
                throw new ArgumentOutOfRangeException("hands", "Number of hands can't exceed deck size.");
            }
            this.Table.Clear();
            for (int i = 1; i <= hands.Length * cardsInHand; i += hands.Length)
            {
                for (int j = 0; j < hands.Length; j++)
                {
                    hands[j].Cards.Add(this.DrawCard());
                }
            }

            Table.Add(this.DrawCard());
        }
Ejemplo n.º 2
0
        private void InitalizeHand()
        {
            bool done = false;

            while (!done)
            {
                _data.PlayerHand.Cards.Clear();
                _data.DeckManager.Shuffle();

                for (int i = 0; i < _data.OpponentsHands.Length; i++)
                {
                    _data.OpponentsHands[i].Cards.Clear();
                }

                Hand[] hands = new Hand[_data.OpponentsHands.Length + 1];
                _data.OpponentsHands.CopyTo(hands, 0);
                hands[_data.OpponentsHands.Length] = _data.PlayerHand;

                _data.DeckManager.Deal(hands, CARDS_PER_HAND);

                if (_data.DeckManager.Table[0] != null && _data.DeckManager.Table[0].Rank != CardRank.Eight)
                {
                    done = true;
                }
            }

            _currentPlayer = _startingPlayer;
            _suitOverride = CardSuit.None;
            _mouseUp = false;
            _prompt = "";
            _undoPointer = 0;
            _lastMouseButton = MouseButtons.None;
            _lastCardsPlayed.Clear();
            _direction = Hand.PlayDirection.Forward;
            _skipFlag = false;

            SetPrompt();
            //if (_currentPlayer == 0)
            //{
            //    _prompt = Properties.Resources.Caption_YourTurn;
            //}
        }