示例#1
0
        /// <summary>
        /// Update the Deck cards Image with face down and the trump card suit face up in Deck Panel
        /// </summary>
        private void UpdateDeckImages()
        {
            // clear the panel
            DeckPanel.Controls.Clear();
            // Get the update deck size
            int lDeckSize = MyGame.Deck.GetDeckSize();

            for (int i = 0; i < lDeckSize; i++)
            {
                // Set the Custom control (ImageControlBox) with Deck cards in vertical position
                ImageCardBox lCard = new ImageCardBox(MyGame.Deck.PlayingCards[i]);
                lCard.Size = new Size(70, 130);
                // if the card is at last position then faceup the card
                if (i != lDeckSize - 1)
                {
                    // set the position of the card to display the Card image
                    lCard.Location = new Point(i + 5, 1);
                }
                else
                {
                    // set the position of the card to display the Card image
                    lCard.Location = new Point(i + 30, 1);
                    // Face up the card
                    lCard.FaceUp = true;
                }
                // Get the Card Image from the resources
                lCard.CardImage = Properties.Resources.ResourceManager.GetObject(MyGame.Deck.PlayingCards.ElementAt(i).CardImage) as Image;
                // Add Custom Control (ImageCardBox) to the Deck Panel
                DeckPanel.Controls.Add(lCard);
            }
        }
示例#2
0
        /// <summary>
        /// Update the RIver cards Images in the River Panel with face UP and Orientation vertical
        /// </summary>
        private void UpdateRiverPanel()
        {
            // clear the panel
            RiverPanel.Controls.Clear();
            // get the Updated River Count
            int lRiverCount = MyGame.River.RiverCards.Count;

            for (int i = 0; i < lRiverCount; i++)
            {
                // Set the Custom control (ImageControlBox) with River cards in vertical position
                ImageCardBox lCard = new ImageCardBox(MyGame.River.RiverCards[i])
                {
                    // Set the position of the card to display the Card image
                    //Location = new Point(i * 50, 0),
                    FaceUp = true,
                    Size   = new Size(70, 130),

                    // Get the Card Image from the resources
                    CardImage = Properties.Resources.ResourceManager.GetObject(MyGame.River.RiverCards.ElementAt(i).CardImage) as Image
                };
                //if (!lCard.FaceUp)
                //    lCard.TurnOver();
                // Add Custom Control (ImageCardBox) to the River Panel
                RiverPanel.Controls.Add(lCard);
                RealignCards(RiverPanel);
            }
        }
示例#3
0
        /// <summary>
        /// Update the Player cards Images in the Player Panel with face UP and Orientation vertical
        /// </summary>
        private void UpdatePlayerPanel()
        {
            // clear the panel
            PlayerPanel.Controls.Clear();
            // get the Updated PLayer Hand Count
            int lPlayerHandCount = MyGame.Players[0].PlayerHand.HandCount();

            for (int i = 0; i < lPlayerHandCount; i++)
            {
                // Set the Custom control (ImageControlBox) with PlayerHand cards in vertical position
                ImageCardBox lCard = new ImageCardBox(MyGame.Players[0].PlayerHand.PlayerHandDeck[i])
                {
                    // Set the position of the card to display the Card image
                    //Location = new Point(i * 50, 0),
                    // Get the Card Image from the resources
                    FaceUp = true,

                    CardImage = Properties.Resources.ResourceManager.GetObject(MyGame.Players[0].PlayerHand.PlayerHandDeck[i].CardImage) as Image
                };


                // click event for the current card
                lCard.Click += Card_Click;
                // mouse enter event
                lCard.MouseEnter += Card_MouseEnter;
                // mouse leave event
                lCard.MouseLeave += Card_MouseLeave;
                // Add Custom Control (ImageCardBox) to the Player Panel
                PlayerPanel.Controls.Add(lCard);
                RealignCards(PlayerPanel);
            }
        }
示例#4
0
        private void Card_MouseEnter(object sender, EventArgs e)
        {
            // Convert sender to a CardBox
            ImageCardBox lCardBox = sender as ImageCardBox;

            // If the conversion worked
            if (lCardBox != null)
            {
                lCardBox.Size = new Size(regularSize.Width + POP, regularSize.Height + POP);
                // Enlarge the card for visual effect
                lCardBox.Top = 0; // move the card to the top edge of the panel.
            }
        }
示例#5
0
        private void Card_MouseLeave(object sender, EventArgs e)
        {
            // Convert sender to a CardBox
            ImageCardBox lCardBox = sender as ImageCardBox;

            // If the conversion worked
            if (lCardBox != null)
            {
                lCardBox.Size = regularSize;
                lCardBox.Top  = POP;
                // resize the card back to regular size
                // move the card down to accommodate for the smaller size.
            }
        }
示例#6
0
        /// <summary>
        /// Update the AIPlayer cards Images in the AIPlayer Panel with face DOWN and Orientation vertical
        /// </summary>
        private void UpdateAIPanel()
        {
            // clear the panel
            AIPlayerPanel.Controls.Clear();
            // get the Updated AIPLayer Hand Count
            int lAIPlayerHandCount = MyGame.Players[1].PlayerHand.HandCount();

            for (int i = 0; i < lAIPlayerHandCount; i++)
            {
                // Set the Custom control (ImageControlBox) with AIPlayerHand cards in vertical position
                ImageCardBox lCard = new ImageCardBox(MyGame.Players[1].PlayerHand.PlayerHandDeck[i])
                {
                    // Set the position of the card to display the Card image
                    //Location = new Point(i *50, 0),
                    // Get the Card Image from the resources
                    FaceUp    = false,
                    CardImage = Properties.Resources.ResourceManager.GetObject(MyGame.Players[1].PlayerHand.PlayerHandDeck.ElementAt(i).CardImage) as Image
                };
                // Add Custom Control (ImageCardBox) to the AIPlayer Panel
                AIPlayerPanel.Controls.Add(lCard);
                RealignCards(AIPlayerPanel);
            }
        }