public void managePlayerMoveAction(string name, int betamount, int totalTableAmount, int totalPlayerBalance, int action)
    {
        PlayerBean playerBean = playersManager.getPlayerFromName(name);

        RoundManager currentRoundManger = getCurrentRoundInfo();

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

        if (!playerBean.isWaitingForGame())
        {
            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;
        }
//		Debug.Log ("Player Moved : " + playerBean.getPlayerName () + " >> Action >> " + action + " >> " + betamount);
        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);
//		playersManager.setPlayerBetAmount (playerBean, betamount, totalBetAmtInRound, totalPlayerBalance);
        setTotalBetTableAmount(totalTableAmount);
        //currentRoundTurns.Add (turnManager);
    }
    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;
    }
    IEnumerator DistributeHandCardsToAllPlayers()
    {
        PlayerBean dealerPlayer     = playersManager.getDealerPlayer();
        GameObject src              = dealerPlayer.getCardDeskObject();
        GameObject cardDeskPosition = dealerPlayer.getCardDeskPositionObject();

        cardDeskPosition.SetActive(true);
        src.SetActive(true);
        int i = 0;

        while (i < playersManager.getAllPlayers().Count)
        {
            PlayerBean player = playersManager.getAllPlayers() [i];
//			DEBUG.Log ("Name : "+ player.getPlayerName()+" >> "+player.isWaitingForGame()+" >> "+ player.isFoldedPlayer());
            if (!player.isWaitingForGame())
            {
//				DEBUG.Log ("Name : "+ player.getPlayerName()+" >< ");
                GameObject card1Obj = player.getCard1Object();
                GameObject card2Obj = player.getCard2Object();
                src.transform.position = cardDeskPosition.transform.position;
                animationManager.MoveCardsObject(src, card1Obj);
                yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

                card1Obj.SetActive(true);

                src.transform.position = cardDeskPosition.transform.position;
                animationManager.MoveCardsObject(src, card2Obj);
                yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

                card2Obj.SetActive(true);
            }
            else
            {
                DEBUG.Log("Name : " + player.getPlayerName());
            }
            i++;
        }
        dealerPlayer.getCardDeskObject().SetActive(false);
        cardDeskPosition.SetActive(false);
        src.transform.position = cardDeskPosition.transform.position;
    }
Example #4
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);
             }
         }
     }
 }