Exemple #1
0
        private void River()
        {
            // На стол добавляется 1 карты
            TableCards.Add(Deck.GetCard());

            // Круг торгов
            BettingRound();
            CollectMoney();
        }
 /// <summary>
 /// 发牌桌的牌
 /// </summary>
 private void DealToTable()
 {
     TableCards.Clear();
     for (int i = 1; i <= GameConfig.Table_Cards_Count; i++)
     {
         var card = PickCardFromPile();
         TableCards.Add(i, card);
     }
 }
Exemple #3
0
        private void Flop()
        {
            // На столе 3 карты
            TableCards.Add(Deck.GetCard());
            TableCards.Add(Deck.GetCard());
            TableCards.Add(Deck.GetCard());

            // Круг торгов
            BettingRound();
            CollectMoney();
        }
        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
                    }
                }
            }
        }