Exemple #1
0
        public GameForm(Game game)
        {
            InitializeComponent();
            this.game = game;
            revealedCardsCount = 0;
            labelPlayerNames = new List<Label>();
            labelChipCount = new List<Label>();
            revealedCards = new List<PictureBox>();
            playerHands = new List<List<PictureBox>>();
            List<PictureBox> playerHand;

            //Add Labels to labelPlayerNames array for reference
            labelPlayerNames.Add(pOneName);
            labelPlayerNames.Add(pTwoName);
            labelPlayerNames.Add(pThreeName);
            labelPlayerNames.Add(pFourName);
            labelPlayerNames.Add(pFiveName);
            labelPlayerNames.Add(pSixName);
            labelPlayerNames.Add(pSevenName);
            labelPlayerNames.Add(pEightName);

            //Add Labels to labelChipCount array for reference
            labelChipCount.Add(labelPOneChipCount);
            labelChipCount.Add(labelPTwoChipCount);
            labelChipCount.Add(labelPThreeChipCount);
            labelChipCount.Add(labelPFourChipCount);
            labelChipCount.Add(labelPFiveChipCount);
            labelChipCount.Add(labelPSixChipCount);
            labelChipCount.Add(labelPSevenChipCount);
            labelChipCount.Add(labelPEightChipCount);

            //Add pictureBoxes to revealedCards array for reference
            revealedCards.Add(pictureBoxFlopOne);
            revealedCards.Add(pictureBoxFlopTwo);
            revealedCards.Add(pictureBoxFlopThree);
            revealedCards.Add(pictureBoxTurn);
            revealedCards.Add(pictureBoxRiver);

            //Add pictureBoxes to playerHands array for reference
            //Player One
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPOneCardOne);
            playerHand.Add(pictureBoxPOneCardTwo);
            playerHands.Add(playerHand);
            //Player Two
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPTwoCardOne);
            playerHand.Add(pictureBoxPTwoCardTwo);
            playerHands.Add(playerHand);
            //Player Three
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPThreeCardOne);
            playerHand.Add(pictureBoxPThreeCardTwo);
            playerHands.Add(playerHand);
            //Player Four
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPFourCardOne);
            playerHand.Add(pictureBoxPFourCardTwo);
            playerHands.Add(playerHand);
            //Player Five
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPFiveCardOne);
            playerHand.Add(pictureBoxPFiveCardTwo);
            playerHands.Add(playerHand);
            //Player Six
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPSixCardOne);
            playerHand.Add(pictureBoxPSixCardTwo);
            playerHands.Add(playerHand);
            //Player Seven
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPSevenCardOne);
            playerHand.Add(pictureBoxPSevenCardTwo);
            playerHands.Add(playerHand);
            //Player Eight
            playerHand = new List<PictureBox>();
            playerHand.Add(pictureBoxPEightCardOne);
            playerHand.Add(pictureBoxPEightCardTwo);
            playerHands.Add(playerHand);

            numericUpDownRaiseAmount.Maximum = int.MaxValue;
            numericUpDownRaiseAmount.Minimum = 0;

            //Mini test suite
            /*
            Card test1 = new Card(Value.Ace, Suit.Clubs);
            Card test2 = new Card(Value.Eight, Suit.Diamonds);
            Card test3 = new Card(Value.Jack, Suit.Hearts);

            revealCard(test1);
            revealCard(test2);

            clearRevealedCards();

            revealCard(test3);

            Player p = new HumanPlayer("Jim", 1000, 2);

            Card test4 = new Card(Value.Two, Suit.Clubs);
            Card test5 = new Card(Value.Seven, Suit.Diamonds);
            List<Card> testHand = new List<Card>();
            testHand.Add(test4);
            testHand.Add(test5);
            p.addCardsToHand(testHand);

            showPlayerHand(p);
            updatePlayer(p);
            */
            //Game game = new Game()
        }
 /*
 *   Will pass all necessary settings data to the next controller.
 *   Hides settings UI
 *   Returns: void
 */
 private void StartGame_Click(object sender, EventArgs e)
 {
     Boolean valid = false;
     valid = finalizeSettings();
     if (valid)
     {
         this.Hide();
         //Pass 'this' to the next controller object
         Game game = new Game(players);
     }
 }