예제 #1
0
    public void manageGameFinishAction(string winnerPlayerName, int rank, int winnerPlayerWinningAmount, int winnerPlayerTotalBalance, List <string> listBestCard)
    {
        if (GAME_STATUS == GameConstant.FINISHED)
        {
            iTween.Stab(gameObject, iTween.Hash("audioclip", winnerAudio, "pitch", 1));
            bool isAllAreFolded = playersManager.isAllPlayersAreFolded();
            defaultCardsManager.openFlopCards();
            defaultCardsManager.openTurnCards();
            defaultCardsManager.openRiverCards();

            resetDefaultCards(false);
            resetWinningPlayers(false);

            isRunningGame = false;
            setEnableDisableOptions(false);

            txtLog.text = txtLog.text.ToString() + "\nWinner is " + winnerPlayerName + "\nRank : " + getRankName((HAND_RANK)rank) + "\nWinning Amount : " + winnerPlayerWinningAmount + "\n";

            PlayerBean winnerPlayer = playersManager.findWinnerPlayerFromName(winnerPlayerName);
            StartCoroutine(manageWinnerPlayers(winnerPlayer));
            winnerPlayer.setPlayerBalance(winnerPlayerTotalBalance);

            //DEBUG.Log ("Game Finish : Winner is " + winnerPlayerName + " >> Rank : " + (HAND_RANK)rank);

            if (!isAllAreFolded)
            {
                winnerPlayer.getRankPannel().SetActive(true);
                winnerPlayer.getRankText().text  = getRankName((HAND_RANK)rank) + " (" + Utility.GetCurrencyPrefix() + "" + winnerPlayerWinningAmount + ")";
                winnerPlayer.getRankText().color = Color.white;
                playersManager.openAllPlayerCards();
                //reset cards
                foreach (string cardName in listBestCard)
                {
                    GameObject cardGameObject = winnerPlayer.getCardObjectFromCardName(cardName);
                    if (cardGameObject != null)
                    {
                        animationManager.WinningCardAnimation(cardGameObject);
                    }
                    else
                    {
                        cardGameObject = defaultCardsManager.getCardObjectFromCardName(cardName);
                        if (cardGameObject != null)
                        {
                            animationManager.WinningCardAnimation(cardGameObject);
                        }
                    }
                }
            }
            //			StartCoroutine(hideWinnerRankPannel(winnerPlayer));
            Invoke("scrollDown", 1f);
        }
    }