Exemplo n.º 1
0
        public void addPlayer(PokerForm form)
        {
            this.PlayerForms.Add(form);
            this.PlayerFormsController.Add(form);
            this.TurnPlayerForm.Add(form);
            Player p = new Player(1000);

            p.PlayerIndex = form.FormIndex;
            p.PlayerId    = form.FormId;
            this.players.Add(p);
        }
Exemplo n.º 2
0
        public PokerForm WinnerForm()
        {
            PokerForm result = null;

            foreach (var form in PlayerForms)
            {
                if (players[players.Count - 1].PlayerId == form.FormId)
                {
                    result = form;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public void SetUpGameInPlay()
        {
            var flag = false;

            PokerForm[] Forms = new PokerForm[3];
            TurnPlayerForm.CopyTo(Forms);
            if (!Folded)
            {
                TurnPlayerForm.RemoveAt(0);
            }
            Folded = false;
            if (Forms[0] != null)
            {
                Forms[0].LockControls();
            }
            // Forms[0].ShowMin();
            if (TurnPlayerForm.Count > 0)
            {
                foreach (PokerForm form in TurnPlayerForm)
                {
                    if (!flag)
                    {
                        form.ShowMin();
                        form.SetUpNewGame();
                        flag = true;
                    }
                    else
                    {
                        form.LockControls();
                    }
                }
            }
            else
            {
                gameState++;
                MinBetAmount = 0;
                foreach (Player p in players)
                {
                    p.ClearBet();
                }
                // FormTurn = 0;
                TurnPlayerForm = new List <PokerForm>(PlayerForms);
                //if(gameState == PokerGame.GameState.TURN)// in order to add another gambling round you need to this
                //TurnPlayerForm.AddRange(PlayerForms);
                var first = TurnPlayerForm[0];
                int j     = 0;
                foreach (PokerForm form in TurnPlayerForm)
                {
                    form.FormIndex = j;
                    j++;
                    form.SetTextBox(gameState.ToString());
                    form.ShowBankValue();
                    if (first == form)
                    {
                        form.SetUpNewGame();
                    }
                    else
                    {
                        form.LockControls();
                    }
                }
                switch (gameState)
                {
                case PokerGame.GameState.FLOP:
                    // gameOverTextBox.Text = "Flop";
                    for (int i = 0; i < 3; i++)
                    {
                        Card flopCard = CurrentDeck.Draw();
                        TableCards.Add(flopCard);
                    }


                    break;

                case PokerGame.GameState.TURN:
                    // gameOverTextBox.Text = "Turn";
                    Card turnCard = CurrentDeck.Draw();
                    TableCards.Add(turnCard);

                    break;

                case PokerGame.GameState.RIVER:
                    // gameOverTextBox.Text = "River";
                    Card riverCard = CurrentDeck.Draw();
                    TableCards.Add(riverCard);


                    break;

                case PokerGame.GameState.ENDGAME:
                    GameOver();
                    break;

                    //case PokerGame.GameState.NewStage: // To Add another level of the game you need to add another enum on gamestate & to the above switch case
                    //    Card newStage = CurrentDeck.Draw();
                    //    TableCards.Add(newStage);
                    //    break;
                }
                foreach (PokerForm form in PlayerForms)
                {
                    switch (gameState)
                    {
                    case PokerGame.GameState.FLOP:

                        form.updateTableCards();
                        break;

                    case PokerGame.GameState.TURN:


                        form.updateTableCards();
                        break;

                    case PokerGame.GameState.RIVER:


                        form.updateTableCards();

                        break;
                        // To Add another level of the game you need to add another enum on gamestate & to the above switch case
                    }
                }
            }
        }
Exemplo n.º 4
0
 public PokerForm(PokerForm pokerForm)
 {
     this.pokerForm = pokerForm;
 }
 public CombinationManager(PokerForm form)
 {
     this.Form = form;
 }