public void DisplayCheckboxes() { // toggleCall.isOn = false; // toggleCallAny.isOn = false; // toggleCheck.isOn = false; // toggleFold.isOn = false; double minBetAmount = 0; if (UIManager.Instance.gameType == POKER_GAME_TYPE.TEXAS) { minBetAmount = RoundController.GetInstance().GetMinBetAmountInCurrentRound() - TexassGame.Instance.ownTexassPlayer.betAmount; minBetAmount = minBetAmount > TexassGame.Instance.ownTexassPlayer.buyInAmount ? TexassGame.Instance.ownTexassPlayer.buyInAmount : minBetAmount; } else if (UIManager.Instance.gameType == POKER_GAME_TYPE.WHOOPASS) { minBetAmount = RoundController.GetInstance().GetMinBetAmountInCurrentRound() - WhoopAssGame.Instance.ownWhoopAssPlayer.betAmount; minBetAmount = minBetAmount > WhoopAssGame.Instance.ownWhoopAssPlayer.buyInAmount ? WhoopAssGame.Instance.ownWhoopAssPlayer.buyInAmount : minBetAmount; } if (minBetAmount <= 0) { cgCheck.interactable = true; } else { cgCheck.interactable = false; txtCall.text = " Call " + Utility.GetAmount(minBetAmount); cgCall.interactable = true; cgCallAny.interactable = true; } cgFold.interactable = true; }
private void HandleWaitingPlayer(PlayerInfo playerInfo) { if (playerInfo.Player_Name.Equals(NetworkManager.Instance.playerID)) { RoundController.GetInstance().currentTableGameRound = GetRound(playerInfo.Current_Round); if (playerInfo.Game_Status == (int)GAME_STATUS.RUNNING || playerInfo.Game_Status == (int)GAME_STATUS.CARD_DISTRIBUTE) { if (playerInfo.Player_Status == (int)PLAYER_STATUS.WAITING || playerInfo.Player_Status == (int)PLAYER_ACTION.ACTION_WAITING_FOR_GAME) { GeneratePlayerCardsForWaitingPlayer(); GenerateDealerFlopCardsForWaitingPlayer(); } } } }
public void DisplayAppropriateBetPanel() { HideBetPanel(); RoundController roundController = RoundController.GetInstance(); switch (roundController.currentTableGameRound) { case TABLE_GAME_ROUND.FIRST_BET: UIManager.Instance.bet1RoundSelectionPanel.SetButtons(anteBetAmount); break; case TABLE_GAME_ROUND.PLAY: UIManager.Instance.bet4RoundSelectionPanel.SetButtons(anteBetAmount); break; case TABLE_GAME_ROUND.SECOND_BET: UIManager.Instance.bet2RoundSelectionPanel.SetButtons(anteBetAmount); break; case TABLE_GAME_ROUND.START: UIManager.Instance.anteAndBlindBetPanel.gameObject.SetActive(true); break; case TABLE_GAME_ROUND.THIRD_BET: UIManager.Instance.bet3RoundSelectionPanel.SetButtons(anteBetAmount); break; case TABLE_GAME_ROUND.WHOOPASS: UIManager.Instance.whoopAssCardRoundPanel.SetTitle(anteBetAmount); break; } btnFold.interactable = true; if (ownTablePlayer.totalChips - ownTablePlayer.buyinChips >= Constants.TABLE_GAME_PLAY_MIN_CHIPS) { btnAddChips.interactable = true; } else { btnAddChips.interactable = false; } }
private void DisplayChipOnPlayerAction(ActionResponse ar) { SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); switch (RoundController.GetInstance().currentTableGameRound) { case TABLE_GAME_ROUND.START: // GenerateChipOnPos (anteImagePosition.position); // // GenerateChipOnPos (blindImagePosition.position); if (ar.IsBetOnStraight) { GenerateChipOnPos(straightOrBetterImagePosition.position); } break; case TABLE_GAME_ROUND.FIRST_BET: GenerateChipOnPos(bet1ImagePosition.position); break; case TABLE_GAME_ROUND.SECOND_BET: GenerateChipOnPos(bet2ImagePosition.position); break; case TABLE_GAME_ROUND.THIRD_BET: GenerateChipOnPos(bet3ImagePosition.position); break; case TABLE_GAME_ROUND.WHOOPASS: if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_NO) { break; } Vector3 targetPos = ar.Action == (int)PLAYER_ACTION.ACTION_WA_UP ? btnUp.transform.position : btnDown.transform.position; GenerateChipOnPos(targetPos); break; case TABLE_GAME_ROUND.PLAY: GenerateChipOnPos(playImagePosition.position); break; } }
public void DisplayTurnTimer() { if (!WhoopAssGame.Instance.isGameCompleted) { if (playerInfo.Player_Status != (int)PLAYER_ACTION.ACTION_WAITING_FOR_GAME && playerInfo.Player_Status != (int)PLAYER_ACTION.FOLD && playerInfo.Player_Status != (int)PLAYER_ACTION.TIMEOUT && playerInfo.Player_Status != (int)PLAYER_ACTION.ALLIN) { StartCoroutine("TurnTimer"); } if (RoundController.GetInstance().currentWhoopAssGameRound == WHOOPASS_GAME_ROUND.WHOOPASS_CARD && playerInfo.Player_Status == (int)PLAYER_ACTION.ALLIN) { StartCoroutine("TurnTimer"); } } }
private void GenerateDealerFlopCardsForWaitingPlayer() { RoundController.GetInstance().GenerateDealerFlopCardsForWaitingPlayer(); }
private void GeneratePlayerCardsForWaitingPlayer() { RoundController.GetInstance().GenerateTablePlayerCardsForWaitingPlayer(); }
private void HandleOnTableGameStarted() { isGameCompleted = false; RoundController.GetInstance().currentTableGameRound = TABLE_GAME_ROUND.START; }
private void HandleOnActionResponseReceived(string sender, string response) { HideTurnTimer(); ActionResponse ar = JsonUtility.FromJson <ActionResponse> (response); if (playerID.Equals(ar.Player_Name)) { buyInAmount = ar.Player_BuyIn_Chips; totalChips = ar.Player_Total_Play_Chips; totalRealMoney = ar.Player_Total_Real_Chips; DisplayTotalChips(); betAmount += ar.Bet_Amount; DisplayBetAmount(); if (ar.Action == (int)PLAYER_ACTION.CHECK) { SoundManager.Instance.PlayCheckActionSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.BET || ar.Action == (int)PLAYER_ACTION.CALL) { SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); } if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_UP) { whoopAssCardAmount = ar.Bet_Amount; betAmount -= whoopAssCardAmount; DisplayUpWhoopAssCard(); //btnDown.gameObject.SetActive(false); btnDown.transform.GetChild(0).gameObject.SetActive(false); SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_DOWN) { whoopAssCardAmount = ar.Bet_Amount; betAmount -= whoopAssCardAmount; DisplayDownWhoopAssCard(); //btnUp.gameObject.SetActive(false); btnUp.transform.GetChild(0).gameObject.SetActive(false); SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_NO) { btnUp.transform.GetChild(0).gameObject.SetActive(false); btnDown.transform.GetChild(0).gameObject.SetActive(false); SoundManager.Instance.PlayCheckActionSound(Camera.main.transform.position); } if (ar.Action == (int)PLAYER_ACTION.TIMEOUT) { GetComponent <CanvasGroup> ().alpha = .4f; if (playerInfo.Player_Status != (int)PLAYER_STATUS.SIT_OUT) { playerInfo.Player_Status = (int)PLAYER_ACTION.TIMEOUT; } SoundManager.Instance.PlayFoldActionSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.FOLD) { GetComponent <CanvasGroup> ().alpha = .4f; if (playerInfo.Player_Status != (int)PLAYER_STATUS.SIT_OUT) { playerInfo.Player_Status = (int)PLAYER_ACTION.FOLD; } SoundManager.Instance.PlayFoldActionSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.ALLIN) { if (playerInfo.Player_Status != (int)PLAYER_STATUS.SIT_OUT) { playerInfo.Player_Status = (int)PLAYER_ACTION.ALLIN; } SoundManager.Instance.PlayAllinActionSound(Camera.main.transform.position); } else if (ar.Action == (int)PLAYER_ACTION.RAISE) { WhoopAssGame.Instance.raisePerRoundCounter++; SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); } txtPlayerName.text = GetPlayerActionInString(ar.Action); txtPlayerName.color = ar.Action == (int)PLAYER_ACTION.FOLD ? Color.red : Color.white; txtTotalChips.text = Utility.GetAmount(betAmount); txtTotalChips.color = Color.white; // playerInfo.Player_Status = ar.Action; HistoryManager.GetInstance().AddHistory(playerID, "name", RoundController.GetInstance().currentWhoopAssGameRound, ar.Bet_Amount, betAmount, GetPlayerAction(ar.Action)); } else { if (playerInfo.Player_Status == (int)PLAYER_STATUS.ACTIVE) { DisplayPlayerData(); } } }
public void DisplayWinReport(WinnerReport winnerReport) { GameManager.Instance.txtGameLog.text += "\n" + winnerReport.Winner.Winner_Name + " -> " + GetWinningRank(winnerReport.Winner.Winner_Rank) + " -> " + Utility.GetAmount(winnerReport.Winner.Winning_Amount); if (winnerReport.Winner.Winner_Name.Equals(Constants.FIELD_PLAYER_NAME_DEALER)) { txtDealerWon.text = "Dealer Won!\n\nDealer's Hand: <color=white>" + GetWinningRank(winnerReport.Winner.Winner_Rank) + "</color>" + "\nPlayer's Hand: <color=white>" + GetWinningRank(winnerReport.Loser.Loser_Rank) + "</color>"; if (winnerReport.Loser.StraightAmount > 0) { txtDealerWon.text += "\nStraight Bet: <color=white>" + winnerReport.Loser.StraightAmount + "</color>"; } if (winnerReport.Loser.BliendAmount > 0) { txtDealerWon.text += "\nBlind Bet: <color=white>" + winnerReport.Loser.BliendAmount + "</color>"; } if (GameManager.Instance.ownTablePlayer != null) { GameManager.Instance.ownTablePlayer.buyinChips += (long)(winnerReport.Loser.StraightAmount + winnerReport.Loser.BliendAmount); if (UIManager.Instance.isRealMoney) { GameManager.Instance.ownTablePlayer.totalRealMoney += (long)(winnerReport.Loser.StraightAmount + winnerReport.Loser.BliendAmount); } else { GameManager.Instance.ownTablePlayer.totalChips += (long)(winnerReport.Loser.StraightAmount + winnerReport.Loser.BliendAmount); } GameManager.Instance.ownTablePlayer.DisplayTotalChips(); if (winnerReport.Loser.StraightAmount + winnerReport.Loser.BliendAmount > Constants.TABLE_GAME_PLAY_MIN_CHIPS) { GameManager.Instance.rebuyPanel.gameObject.SetActive(false); } } txtBlindBet.text = txtPayoutAmount.text = txtStraightOrBetter.text = txtTotalBet.text = txtWhoopAssCard.text = ""; dealerWinParent.SetActive(true); tieParent.SetActive(false); } else { if (winnerReport.Winner.IsTie) { SetTieDescription(winnerReport); tieParent.SetActive(true); } else { SetPlayerWinReportDetails(winnerReport); tieParent.SetActive(false); } } if (GameManager.Instance.ownTablePlayer.playerInfo.Player_Status != (int)PLAYER_ACTION.ACTION_WAITING_FOR_GAME && (int)RoundController.GetInstance().currentTableGameRound > (int)TABLE_GAME_ROUND.START) { SetWinningCards(winnerReport.Winner.Winner_Best_Cards); SetDealerBestCards(winnerReport.Loser.Loser_Best_Cards); if (winnerReport.Winner.Winner_Name.Equals(Constants.FIELD_PLAYER_NAME_DEALER)) { txtTitle.text = Constants.WIN_REPORT_TITLE; txtDealerHandRank.text = "Dealer's Hand: " + GetWinningRank(winnerReport.Winner.Winner_Rank); SetWinningCards(winnerReport.Loser.Loser_Best_Cards); SetDealerBestCards(winnerReport.Winner.Winner_Best_Cards); } else { txtTitle.text = Constants.WIN_REPORT_TITLE + " - " + GetWinningRank(winnerReport.Winner.Winner_Rank); txtDealerHandRank.text = "Dealer's Hand: " + GetWinningRank(winnerReport.Loser.Loser_Rank); SetWinningCards(winnerReport.Winner.Winner_Best_Cards); SetDealerBestCards(winnerReport.Loser.Loser_Best_Cards); } if (winnerReport.Winner.IsTie) { txtTitle.text = Constants.WIN_REPORT_TITLE; } } else { winningCardsObject.SetActive(false); txtTitle.text = Constants.WIN_REPORT_TITLE; } SoundManager.Instance.PlayGameCompleteSound(Camera.main.transform.position); gameObject.SetActive(true); }
private void HandleOnActionResponseReceived(string sender, string response) { ActionResponse ar = JsonUtility.FromJson <ActionResponse> (response); if (playerID.Equals(ar.Player_Name)) { buyinChips = ar.Player_BuyIn_Chips; totalRealMoney = ar.Player_Total_Real_Chips; totalChips = ar.Player_Total_Play_Chips; DisplayTotalChips(); betAmount += ar.Bet_Amount; DisplayBetAmount(); if (ar.Bet_Amount > 0) { DisplayChipOnPlayerAction(ar); } if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_UP) { DisplayUpWhoopAssCard(); } else if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_DOWN) { DisplayDownWhoopAssCard(); } if (ar.Action == (int)PLAYER_ACTION.CHECK) { SoundManager.Instance.PlayCheckActionSound(Camera.main.transform.position); } // Display dealer WA card if (ar.Action == (int)PLAYER_ACTION.ACTION_WA_UP || ar.Action == (int)PLAYER_ACTION.ACTION_WA_DOWN || ar.Action == (int)PLAYER_ACTION.ACTION_WA_NO) { if (playerID.Equals(NetworkManager.Instance.playerID)) { GameManager.Instance.dealerWhoopAssCard.gameObject.SetActive(true); } SoundManager.Instance.PlayBetCallSound(Camera.main.transform.position); } if (ar.Action == (int)PLAYER_ACTION.TIMEOUT) { GetComponent <CanvasGroup> ().alpha = .4f; playerInfo.Player_Status = (int)PLAYER_ACTION.TIMEOUT; SoundManager.Instance.PlayFoldActionSound(Camera.main.transform.position); playerFoldParent.SetActive(true); } else if (ar.Action == (int)PLAYER_ACTION.FOLD) { GetComponent <CanvasGroup> ().alpha = .4f; playerInfo.Player_Status = (int)PLAYER_ACTION.FOLD; SoundManager.Instance.PlayFoldActionSound(Camera.main.transform.position); playerFoldParent.SetActive(true); } else if (ar.Action == (int)PLAYER_ACTION.ALLIN) { playerInfo.Player_Status = (int)PLAYER_ACTION.ALLIN; SoundManager.Instance.PlayAllinActionSound(Camera.main.transform.position); } // playerInfo.Player_Status = ar.Action; HistoryManager.GetInstance().AddHistory(playerID, "name", RoundController.GetInstance().currentTableGameRound, ar.Bet_Amount, betAmount, GetPlayerAction(ar.Action), ar.IsBetOnStraight); } }