示例#1
0
        public void refreshPlayer(Player player, GameState state)
        {
            if (player != null && !(player.outOfMoney() && !player.inHand))
            {
                this.player = player;
                playerName.Text = player.name;
                this.chipCount.Text = player.chipCount.ToString();
                this.chipsCommitted.Text = player.chipsCommitted.ToString();
                this.lastAction.Text = player.lastAction;
                if (player.human)
                    revealCards();
                else if (player.inHand)
                    this.playerCards.Text = "HAS CARDS.";
                else
                    this.playerCards.Text = "NO CARDS.";

                if (state.players[state.buttonPos] == player)
                {
                    playerButton.Image = button;
                    playerButton.Show();
                }
                else
                    playerButton.Hide();

                if (state.nextToPlay() == player)
                {
                    playerAction.Image = action;
                    playerAction.Show();
                }
                else
                    playerAction.Hide();
            }
            else
                makeEverythingEmpty();
        }
示例#2
0
        public void play(GameState state)
        {
            while (!state.nextToPlay().human && !state.allDoneWithTurn())
            {
                state.nextToPlay().play(state);

                state.updateGameState();
            }

            if (state.allDoneWithTurn() || state.playersInHand() < 2)
                if (progressHand(state.handStep))
                { // progresses hand and returns whether hand is over (the last handStep was river)
                    endHand(state);
                    return;
                }
                else
                    play(state);
            if(!state.gameOver)
            if(state.nextToPlay().human)
                currentHumanPlayer = (HumanPlayer)state.nextToPlay();
        }