Beispiel #1
0
        /* Note that we are sharing the handcontrollayout between the board and the player cards.
         * This is going to work OK because the DisplayPlayerHand method is going to be called ALWAYS
         * before the DisplayBoard. Subsequent calls to DisplayPlayerHand will not change the UI as the hand
         * is going to be the same */
        protected void UpdateBoardOdds(HoldemBoard board)
        {
            // Update only if the hand is different than the previous one and we have a player hand
            if (BoardHasChanged(board) && lastPlayerHand != null)
            {
                // Clear previous stuff
                handControlLayout.Controls.Clear();

                // Display current hand
                CardListPanel playerCardsPanel = new CardListPanel();
                playerCardsPanel.BackColor     = Color.Transparent;
                playerCardsPanel.CardSpacing   = CARD_SPACING;
                playerCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                playerCardsPanel.CardListToDisplay = lastPlayerHand;
                playerCardsPanel.Height            = 70;
                handControlLayout.Controls.Add(playerCardsPanel);

                // Display board
                CardListPanel boardCardsPanel = new CardListPanel();
                boardCardsPanel.BackColor     = Color.Transparent;
                boardCardsPanel.CardSpacing   = CARD_SPACING;
                boardCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                boardCardsPanel.CardListToDisplay = board;
                boardCardsPanel.Height            = 70;
                handControlLayout.Controls.Add(boardCardsPanel);

                DisplayOdds((HoldemHand)lastPlayerHand, board);
            }
        }
        public void DisplayFinalBoard(Board board)
        {
            CardListPanel clp = new CardListPanel();

            clp.CardListToDisplay = board;
            clp.CardSpacing       = 4;
            clp.BackColor         = Color.Transparent;

            /* We set the initial size of the component to the largest possible, the
             * addPanel method will take care of setting the proper size */
            clp.Size = entityHandsContainer.Size;

            entityHandsContainer.AddPanel(clp, MAXIMUM_CARD_LIST_PANEL_HEIGHT);
        }
        protected virtual void UpdateHandTab(Hand playerHand)
        {
            // Update only if the hand is different than the previous one
            if (PlayerHandHasChanged(playerHand))
            {
                // Clear previous stuff
                handControlLayout.Controls.Clear();

                // Display current hand
                CardListPanel playerCardsPanel = new CardListPanel();
                playerCardsPanel.BackColor     = Color.Transparent;
                playerCardsPanel.CardSpacing   = CARD_SPACING;
                playerCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                playerCardsPanel.CardListToDisplay = playerHand;
                playerCardsPanel.Height            = 80;
                handControlLayout.Controls.Add(playerCardsPanel);

                DisplayOdds(playerHand);
            }
        }
        /* Note that we are sharing the handcontrollayout between the board and the player cards.
         * This is going to work OK because the DisplayPlayerHand method is going to be called ALWAYS
         * before the DisplayBoard. Subsequent calls to DisplayPlayerHand will not change the UI as the hand
         * is going to be the same */
        protected void UpdateBoardOdds(HoldemBoard board)
        {
            // Update only if the hand is different than the previous one and we have a player hand
            if (BoardHasChanged(board) && lastPlayerHand != null)
            {
                // Clear previous stuff
                handControlLayout.Controls.Clear();

                // Display current hand
                CardListPanel playerCardsPanel = new CardListPanel();
                playerCardsPanel.BackColor = Color.Transparent;
                playerCardsPanel.CardSpacing = CARD_SPACING;
                playerCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                playerCardsPanel.CardListToDisplay = lastPlayerHand;
                playerCardsPanel.Height = 70;
                handControlLayout.Controls.Add(playerCardsPanel);

                // Display board
                CardListPanel boardCardsPanel = new CardListPanel();
                boardCardsPanel.BackColor = Color.Transparent;
                boardCardsPanel.CardSpacing = CARD_SPACING;
                boardCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                boardCardsPanel.CardListToDisplay = board;
                boardCardsPanel.Height = 70;
                handControlLayout.Controls.Add(boardCardsPanel);

                DisplayOdds((HoldemHand)lastPlayerHand, board);
            }
        }
        protected virtual void UpdateHandTab(Hand playerHand)
        {
            // Update only if the hand is different than the previous one
            if (PlayerHandHasChanged(playerHand))
            {
                // Clear previous stuff
                handControlLayout.Controls.Clear();

                // Display current hand
                CardListPanel playerCardsPanel = new CardListPanel();
                playerCardsPanel.BackColor = Color.Transparent;
                playerCardsPanel.CardSpacing = CARD_SPACING;
                playerCardsPanel.BorderPadding = CARD_BORDER_PADDING;

                playerCardsPanel.CardListToDisplay = playerHand;
                playerCardsPanel.Height = 80;
                handControlLayout.Controls.Add(playerCardsPanel);

                DisplayOdds(playerHand);
            }
        }
        public void DisplayFinalBoard(Board board)
        {
            CardListPanel clp = new CardListPanel();
            clp.CardListToDisplay = board;
            clp.CardSpacing = 4;
            clp.BackColor = Color.Transparent;

            /* We set the initial size of the component to the largest possible, the
                * addPanel method will take care of setting the proper size */
            clp.Size = entityHandsContainer.Size;

            entityHandsContainer.AddPanel(clp, MAXIMUM_CARD_LIST_PANEL_HEIGHT);
        }