예제 #1
0
    public void addNewPlayerOnTable(int id, string playerName, int balance, string card1, string card2, string waCard, int gameStatus, int playerStatus)
    {
        PlayerBean playerTmp = playersManager.getPlayerFromName(playerName);

        if (playerTmp == null)
        {
            PlayerBean player = new PlayerBean(
                gameObjectManager.getPlayerGameObject(playersManager.totalPlayerOnTable()),
                gameObjectManager.getPlayerChipsObject(playersManager.totalPlayerOnTable()),
                id,
                playerName,
                balance,
                card1,
                card2, waCard);
            player.setBetAmount(0, 0);
            if (playerStatus == GameConstant.ACTION_FOLDED)
            {
                player.setFoldedPlayer(true);
            }
            else if (playerStatus == GameConstant.ACTION_WAITING_FOR_GAME)
            {
                player.setIsWatingForGamePlayer();
                playersManager.closeActivePlayersCards();
            }
            playersManager.addPlayer(player);
        }
        else
        {
            playerTmp.setCardsAndBalance(balance, card1, card2, waCard);
        }

        if (playersManager.getAllPlayers().Count < GameConstant.MIN_PLAYER_TO_START_GAME)
        {
            waitingForMinPlayer();
        }
    }