Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new CardBox and deals it to the specified panel
        /// </summary>
        /// <param name="panel"></param>
        public void DealCardToPanel(Panel panel, PlayingCard card)
        {
            CardBox pbCard = new CardBox(card);

            pbCard.FaceDown();
            if (panel == pnlPlayerBottom || aiCardsVisible)
            {
                pbCard.FaceUp();
            }
            panel.Controls.Add(pbCard);
            AlignCards(panel);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Give river to a players hand
        /// </summary>
        /// <param name="player">Player to give river to</param>
        public void GiveRiver(IPlayer player)
        {
            Panel toPanel     = null;
            bool  putFaceDown = false;

            lblStatus.Text = player.Name + " takes the river!";
            Wait(200);
            if (player.GetType() == typeof(Player))
            {
                toPanel = pnlPlayerBottom;
            }
            else if (player.GetType() == typeof(ComputerPlayer))
            {
                toPanel     = pnlPlayerTop;
                putFaceDown = true;
            }

            for (int slide = 0; slide < 20; slide++)
            {
                for (int i = 0; i < pnlPlayArea.Controls.Count; i++)
                {
                    pnlPlayArea.Controls[i].Top += (toPanel == pnlPlayerBottom ? slide : -slide);
                }
                Wait(3);
            }

            for (int i = pnlPlayArea.Controls.Count - 1; i >= 0; i--)
            {
                CardBox cb = (CardBox)pnlPlayArea.Controls[i];
                if (!putFaceDown || aiCardsVisible)
                {
                    cb.FaceUp();
                }
                else
                {
                    cb.FaceDown();
                }
                toPanel.Controls.Add(cb);
                AlignCards(toPanel);
                Wait(100);
            }

            if (player.TurnStatus == TurnStatus.Attacking)
            {
                durakGame.NextAttacker();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Play a players card
        /// </summary>
        /// <param name="cardIndex">Index of card to play</param>
        /// <param name="playerIndex">Index of player</param>
        public void PlayCardAt(int cardIndex, int playerIndex)
        {
            Panel   panel = (playerIndex == 0 ? pnlPlayerBottom : pnlPlayerTop);
            CardBox cb    = panel.Controls[cardIndex] as CardBox;

            if (playerIndex == 0)
            {
                EndHumanResponse();
            }
            else
            {
                Wait(AI_ATTACK_DELAY);
                cb.FaceUp();
            }
            cb.Size = CardBox.CARD_SIZE;
            pnlPlayArea.Controls.Add(cb);
            AlignCards(panel);
            AlignCards(pnlPlayArea);
        }