예제 #1
0
        private void start_button_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Start game clicked");
            Game game = new Game(enteredchips, enteredname);

            Console.WriteLine("Buy-in: " + game.getChips());
            Console.WriteLine("Small Blind: " + game.getSmallBlind());
            Console.WriteLine("Big Blind: " + game.getBigBlind());
            Console.WriteLine("Player: " + enteredname);
            Console.WriteLine(game.getPlayer().getName());
            Console.WriteLine(game.getPlayer().getCurrentChips());

            this.Hide();
            Gamewindow gamewindow = new Gamewindow(game);

            gamewindow.ShowDialog();
        }
예제 #2
0
        public void startHand()
        {
            //Initialize gamewindow
            gamewindow = currentgame.getGameWindow();
            //Shuffle the deck on starthand
            getDeck().shuffleDeck();
            //Pick two cards from the top of the deck and give them to the players
            currentgame.getPlayer().addToHand(getDeck().getTopCard());
            currentgame.getPlayer().addToHand(getDeck().getTopCard());
            currentgame.getAiPlayer().addToHand(getDeck().getTopCard());
            currentgame.getAiPlayer().addToHand(getDeck().getTopCard());
            //Get the two cards from the starthand of the player
            Card playercard1 = currentgame.getPlayer().getHand()[0];
            Card playercard2 = currentgame.getPlayer().getHand()[1];

            Console.WriteLine("Human player cards:");
            Console.WriteLine(playercard1.getValue() + playercard1.getSuit());
            Console.WriteLine(playercard2.getValue() + playercard2.getSuit());
            Card aiplayercard1 = currentgame.getAiPlayer().getHand()[0];
            Card aiplayercard2 = currentgame.getAiPlayer().getHand()[1];

            Console.WriteLine("AI player cards: ");
            Console.WriteLine(aiplayercard1.getValue() + aiplayercard1.getSuit());
            Console.WriteLine(aiplayercard2.getValue() + aiplayercard2.getSuit());

            //Add filepath of each card
            string file_playercard1   = playercard1.getValue() + "of" + playercard1.getSuit() + ".png";
            string file_playercard2   = playercard2.getValue() + "of" + playercard2.getSuit() + ".png";
            string path_playercard1   = Path.Combine(path, file_playercard1);
            string path_playercard2   = Path.Combine(path, file_playercard2);
            string file_aiplayercard1 = aiplayercard1.getValue() + "of" + aiplayercard1.getSuit() + ".png";
            string file_aiplayercard2 = aiplayercard2.getValue() + "of" + aiplayercard2.getSuit() + ".png";
            string path_aiplayercard1 = Path.Combine(path, file_aiplayercard1);
            string path_aiplayercard2 = Path.Combine(path, file_aiplayercard2);

            gamewindow.changePictureBox(gamewindow.player_card1, path_playercard1);
            gamewindow.changePictureBox(gamewindow.player_card2, path_playercard2);
            gamewindow.changePictureBox(gamewindow.ai_card1, path_aiplayercard1);
            gamewindow.changePictureBox(gamewindow.ai_card2, path_aiplayercard2);
            currentgame.playSession("player");
        }
예제 #3
0
파일: Game.cs 프로젝트: Stahlisen/PokerGame
 public void initiateGameWindow(Gamewindow gw)
 {
     gamewindow = gw;
 }