public void highLightTurnPlayer(string player)
    {
        if (isRunningGame)
        {
            PlayerBean currentPlayer = playersManager.setCurrentTurnPlayer(player);

            if (appwarp.username.Equals(player))
            {
                playerBalance = currentPlayer.getBalance();
                RoundManager currentRoundManager = getCurrentRoundInfo();
                if (currentPlayer.isWaitingForGame())
                {
                    sendPlayerActionToServer(0, GameConstant.ACTION_WAITING_FOR_GAME);
                }
                else if (currentRound != GameConstant.TEXASS_ROUND_PREFLOP &&
                         currentRoundManager.getAllTurnRecords().Count == 0 &&
                         !currentPlayer.getPlayerName().Equals(playersManager.getSmallBlindPlayer().getPlayerName()))
                {
                    sendPlayerActionToServer(0, GameConstant.ACTION_NO_TURN);
                }
                else if (currentPlayer.isFoldedPlayer())
                {
                    sendPlayerActionToServer(0, GameConstant.ACTION_FOLDED);
                }
                else if (currentPlayer.isAllInPlayer())
                {
                    sendPlayerActionToServer(0, GameConstant.ACTION_ALL_IN);
                }
                else
                {
                    setEnableDisableOptions(true);
                }
            }
            else
            {
                playerBalance = 0;
                setEnableDisableOptions(false);
                //gameManagerGameObject.transform.Find(GameConstant.UI_PATH_BUTTONS).gameObject.SetActive(false);
            }
        }
        //raiseValue = 0;
        //gameManagerGameObject.transform.Find (GameConstant.UI_PATH_BET_CHIP_DETAILS).GetComponent<Text> ().text = GameConstant.CURRENCY + raiseValue;
    }
Example #2
0
    public void managePlayerMoveAction(string name, int betamount, int totalTableAmount, int totalPlayerBalance, int action)
    {
        PlayerBean   playerBean         = playersManager.getPlayerFromName(name);
        RoundManager currentRoundManger = getCurrentRoundInfo();

        if (currentRound == GameConstant.WA_ROUND_START && playerBean.isBigBlindPlayer())
        {
            totalBBPlayersTurn++;
        }

        if (currentRoundManger.getRound() == GameConstant.WA_ROUND_WHOOPASS)
        {
            StartCoroutine(managePlayerWACardAction(action, playerBean));
        }
        txtLog.text = txtLog.text.ToString() + "\n" + playerBean.getPlayerName() + " >> Action >> " + getActionName(action) + " >> " + betamount;
        Invoke("scrollDown", 1f);
        if (betamount > 0)
        {
            animationManager.MoveChipsObject(playerBean.getChipObject(), gameObjectManager.getTableChipSetObject());
//			yield return new WaitForSeconds (GameConstant.ANIM_WAITING_TIME);
            playerBean.getChipObject().transform.position = playerBean.getChipPositionObject().transform.position;
        }
        TurnManager turnManager = new TurnManager(playerBean, action, betamount);

        currentRoundManger.addTurnRecord(turnManager);
        int totalBetAmtInRound = currentRoundManger.getTotalPlayerBetAmount(playerBean);

        playerBean.setBetAmount(betamount, totalBetAmtInRound);
        playersManager.setLastPlayerAction(name, action, betamount, totalBetAmtInRound, totalPlayerBalance);
        if (playerBean.getBalance() <= 0 && !playerBean.isAllInPlayer())
        {
            playerBean.setPlayerBalance(0);              // if player balance is not enough
            playerBean.setAllInStatus(true);
        }
        setTotalBetTableAmount(totalTableAmount);
    }
    public void setBigBlindDefaultBet()
    {
        PlayerBean bigBlind  = playersManager.getBigBlindPlayer();
        int        betAmount = smallBlindAmount * 2;

//		StartCoroutine( managePlayerMoveAction (bigBlind.getPlayerName (), betAmount, smallBlindAmount + betAmount, bigBlind.getBalance () - betAmount, GameConstant.ACTION_BET));
        managePlayerMoveAction(bigBlind.getPlayerName(), betAmount, smallBlindAmount + betAmount, bigBlind.getBalance() - betAmount, GameConstant.ACTION_BET);
    }
    public void setSmallBlindDefaultBet()
    {
        PlayerBean smallBlind = playersManager.getSmallBlindPlayer();

//		StartCoroutine( managePlayerMoveAction (smallBlind.getPlayerName (), smallBlindAmount, smallBlindAmount, (smallBlind.getBalance () - smallBlindAmount), GameConstant.ACTION_BET));
        managePlayerMoveAction(smallBlind.getPlayerName(), smallBlindAmount, smallBlindAmount, (smallBlind.getBalance() - smallBlindAmount), GameConstant.ACTION_BET);
    }
Example #5
0
 public void highLightTurnPlayer(string player)
 {
     if (isRunningGame)
     {
         PlayerBean currentPlayer = playersManager.setCurrentTurnPlayer(player);
         if (appwarp.username.Equals(player))
         {
             playerBalance = currentPlayer.getBalance();
             RoundManager currentRoundManager = getCurrentRoundInfo();
             if (currentPlayer.isWaitingForGame())
             {
                 sendPlayerActionToServer(0, GameConstant.ACTION_WAITING_FOR_GAME);
             }
             else if (currentRound != GameConstant.WA_ROUND_START &&
                      currentRoundManager.getAllTurnRecords().Count == 0 &&
                      !currentPlayer.getPlayerName().Equals(playersManager.getSmallBlindPlayer().getPlayerName()))
             {
                 sendPlayerActionToServer(0, GameConstant.ACTION_NO_TURN);
             }
             else if (currentRound == GameConstant.WA_ROUND_WHOOPASS)
             {
                 if (currentPlayer.isFoldedPlayer())
                 {
                     sendPlayerActionToServer(0, GameConstant.ACTION_WA_NO);
                     waPurchaseOption.SetActive(false);
                 }
                 else
                 {
                     // Check second flop round bet amount
                     waCardAmt = secondFlopRound.getWACardAmount();
                     // Check first flop round bet amount if WA amount 0
                     waCardAmt = waCardAmt == 0 ? firstFlopRound.getWACardAmount() : waCardAmt;
                     // Second flop round bet amount is 0 then WA card is depend on Big blind amount
                     waCardAmt = waCardAmt == 0 ? smallBlindAmount * 2 : waCardAmt;
                     // If player have not enough balance then WA card is based on player balance
                     PlayerBean loginPlayer = playersManager.getPlayerFromName(appwarp.username);
                     if (loginPlayer.getBalance() < waCardAmt)
                     {
                         waCardAmt = loginPlayer.getBalance();
                     }
                     if (currentPlayer.isAllInPlayer())
                     {
                         txtWATitle.text = "Buy WhoopAss Card for FREE.";
                     }
                     else
                     {
                         txtWATitle.text = "Buy WhoopAss Card for " + Utility.GetCurrencyPrefix() + waCardAmt;
                     }
                     waPurchaseOption.SetActive(true);
                 }
             }
             else
             {
                 if (currentPlayer.isFoldedPlayer())
                 {
                     sendPlayerActionToServer(0, GameConstant.ACTION_FOLDED);
                 }
                 else if (currentPlayer.isAllInPlayer())
                 {
                     sendPlayerActionToServer(0, GameConstant.ACTION_ALL_IN);
                 }
                 else
                 {
                     setEnableDisableOptions(true);
                 }
             }
         }
         else
         {
             if (currentRound == GameConstant.WA_ROUND_WHOOPASS)
             {
                 waPurchaseOption.SetActive(false);
             }
             else
             {
                 playerBalance = 0;
                 setEnableDisableOptions(false);
             }
         }
     }
 }