Beispiel #1
0
        private void setPlayers(singleGame game)
        {
            pictureBoxTable.Refresh();

            if (currentGameNum < 20)
            {
                buttonPush.Show();
                buttonFold.Show();
            }
            else
            {
                buttonPush.Hide();
                buttonFold.Hide();
            }

            buttonFold.Text = "Fold";
            if (game.pushOrCall == 0) // push
                buttonPush.Text = "All-in";
            else
                buttonPush.Text = "Call";

            if (game.numOfPlayers == 2)
            {
                showPlayer(1, true, true);
                showPlayer(2, false, false);
                showPlayer(3, true, true);
                showPlayer(4, false, false);
                player3.resetVars();
                player1.resetVars();

                if (game.pushOrCall == 0) // push
                {
                    player1.Range  = game.ranges[0];
                    player1.Stack  = Convert.ToString(game.stacks[0] - game.BBsize) + "$";
                    player1.Bets   = game.BBsize;
                    player3.Range  = 0;
                    player3.Stack  = Convert.ToString(game.stacks[1] - (game.BBsize / 2)) + "$";
                    player3.Bets   = game.BBsize / 2;
                    player3.Dealer = true;
                }
                else  // call
                {
                    player1.Range = game.raiserRange;
                    player1.Stack = "ALL-IN";
                    player1.Bets  = game.stacks[1];
                    player1.Dealer = true;
                    player3.Range = 0;
                    player3.Stack = Convert.ToString(game.stacks[0] - game.BBsize) + "$";
                    player3.Bets = game.BBsize;
                }
            }
            //else if (game.numOfPlayers == 3)
            else
            {
                showPlayer(1, true, true);
                showPlayer(2, true, true);
                showPlayer(3, true, true);
                if (game.numOfPlayers == 4)
                    showPlayer(4, true, true);
                else
                    showPlayer(4, false, false);

                Player[] players = new Player[game.numOfPlayers];

                if (game.position == 0)
                {
                    players[0] = player3;
                    players[1] = player2;
                    players[2] = player1;
                    if(game.numOfPlayers == 4)
                        players[3] = player4;
                }
                else if (game.position == 1)
                {
                    if (game.numOfPlayers == 3)
                    {
                        players[0] = player1;
                        players[1] = player3;
                        players[2] = player2;
                    }
                    else
                    {
                        players[0] = player4;
                        players[1] = player3;
                        players[2] = player2;
                        players[3] = player1;
                    }
                }
                else if (game.position == 2)
                {
                    if (game.numOfPlayers == 3)
                    {
                        players[0] = player2;
                        players[1] = player1;
                        players[2] = player3;
                    }
                    else
                    {
                        players[0] = player1;
                        players[1] = player4;
                        players[2] = player3;
                        players[3] = player2;
                    }
                }
                else if (game.position == 3)
                {
                    players[0] = player2;
                    players[1] = player1;
                    players[2] = player4;
                    players[3] = player3;
                }

                // käydään pelaajat läpi ja asetetaan parametrit
                for (int i = game.numOfPlayers-1; i >= 0; i--)
                {
                    players[i].resetVars();

                    /*
                    // jos tutkittava pelaaja ennen korottajaa, niin piilotetaan kortit
                    if (i > game.raiserPos && game.raiserPos != game.position)
                    //if (i > game.raiserPos)
                        players[i].showCards(false);
                    else
                        players[i].showCards(true);
                    */

                    // korottajan stäkit, betit ja ranget
                    if (i == game.raiserPos)
                    {
                        players[i].showCards(true);

                        // jos joku muu reissaa niin range ja "ALL-IN" näkyviin jos joku muu kuin itse
                        if (game.raiserPos != game.position)
                        {
                            players[i].Range = game.raiserRange;
                            players[i].Stack = "ALL-IN";
                            players[i].Bets = game.stacks[i];
                        }
                        // itse reissaaja
                        else
                        {
                            players[i].Range = 0;
                            if (i == 1) // pikkublindissä
                            {
                                players[i].Stack = Convert.ToString(game.stacks[i] - game.BBsize / 2) + "$";
                                players[i].Bets = game.BBsize / 2;
                            }
                            else // jossain muussa positiossa
                            {
                                players[i].Stack = Convert.ToString(game.stacks[i]) + "$";
                                players[i].Bets = 0;
                            }

                        }
                    }
                    // muiden kuin korottajan stäkit, betit ja ranget
                    else
                    {
                        // jos toimii ennen reissaajaa
                        if (i > game.raiserPos)
                        {
                            players[i].Range = 0;
                            players[i].Stack = Convert.ToString(game.stacks[i]) + "$";
                            players[i].Bets = 0;
                            players[i].showCards(false);
                        }
                        // reissaajan jälkeen
                        else
                        {
                            // jos ollaan itse maksamassa reissaajan allia
                            if (i == game.position)
                            {
                                players[i].showCards(true);
                                players[i].Range = 0;

                                if (i == 0) // isossa blindissä
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i] - game.BBsize) + "$";
                                    players[i].Bets = game.BBsize;
                                }
                                else if (i == 1) // pikkublindissä
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i] - game.BBsize / 2) + "$";
                                    players[i].Bets = game.BBsize / 2;
                                }
                                else // jossain muussa positiossa
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i]) + "$";
                                    players[i].Bets = 0;
                                }
                            }
                            // muut reissaajan jälkeen toimivat pelaajat kuin itse
                            else
                            {
                                // reissaajan ja oman itse välissä olevien pelaajien kortit piilotetaan "foldattuina"
                                if(i < game.raiserPos && i > game.position)
                                    players[i].showCards(false);
                                else
                                    players[i].showCards(true);

                                // jos ollaan itse reissaaja, niin vastustajille call -ranget näkyviin
                                if (game.raiserPos == game.position)
                                    players[i].Range = game.ranges[i];

                                if (i == 0) // isossa blindissä
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i] - game.BBsize) + "$";
                                    players[i].Bets = game.BBsize;
                                }
                                else if (i == 1) // pikkublindissä
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i] - game.BBsize / 2) + "$";
                                    players[i].Bets = game.BBsize / 2;
                                }
                                else // jossain muussa positiossa
                                {
                                    players[i].Stack = Convert.ToString(game.stacks[i]) + "$";
                                    players[i].Bets = 0;
                                }
                            }
                        }
                    }
                }

                // kolmas pelaaja on aina jakaja
                players[2].Dealer = true;
            }

            for (int i =0; i < games.Length; i++)
                if (games[i] == game)
                {
                    labelGameNumber.Text = (i+1) + " / 20";
                    break;
                }

            // näytetään omat kortit aina
            Cards.drawCard(myCard1, game.myHand[0], Cards.mdFaceUp);
            Cards.drawCard(myCard2, game.myHand[1], Cards.mdFaceUp);
        }
Beispiel #2
0
        private void showPlayer(int num, bool enable, bool enableCards)
        {
            Player[] players = new Player[4];
            players[0] = player1;
            players[1] = player2;
            players[2] = player3;
            players[3] = player4;

            if (enable == true)
            {
                players[num - 1].Show();
                if (enableCards == true)
                {
                    players[num - 1].showCards(true);
                    if (num != 3)
                    {
                        Cards.drawCardBack(players[num - 1].card1);
                        Cards.drawCardBack(players[num - 1].card2);
                    }
                }
                else
                    players[num - 1].showCards(false);
            }
            else
            {
                players[num - 1].Hide();
                players[num - 1].showCards(false);
            }
        }
Beispiel #3
0
        private void player1_MouseEnter(object sender, EventArgs e)
        {
            mouseoverplayer = (Player) sender;
            if (mouseoverplayer.Range == 0)
                return;

            timerTooltip.Enabled = true;
        }