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 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); }
public void setBigBlindDefaultBet() { PlayerBean bigBlind = playersManager.getBigBlindPlayer(); int betAmount = smallBlindAmount * 2; managePlayerMoveAction(bigBlind.getPlayerName(), betAmount, smallBlindAmount + betAmount, bigBlind.getBalance() - betAmount, GameConstant.ACTION_BET); }
public void addPlayer(PlayerBean playerBean) { listPlayers.Add(playerBean); if (playerBean.getPlayerName().Equals(appwarp.username)) { loggedPlayer = playerBean; } }
public int getPlayerLastAction(PlayerBean player) { int action = 0; foreach (TurnManager turnManager in listTurn) { if (turnManager.getPlayer().getPlayerName().Equals(player.getPlayerName())) { action = turnManager.getPlayerAction(); } } return(action); }
public int getTotalPlayerBetAmount(PlayerBean player) { int totalBet = 0; foreach (TurnManager turnManager in listTurn) { if (turnManager.getPlayer().getPlayerName().Equals(player.getPlayerName())) { totalBet += turnManager.getBetAmount(); // This will add every turn bet amount // totalBet = turnManager.getBetAmount (); // total round bet } } return(totalBet); }
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; }
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 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); } } } }