Exemplo n.º 1
0
    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];
            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);
            i++;
        }
        dealerPlayer.getCardDeskObject().SetActive(false);
        cardDeskPosition.SetActive(false);
        src.transform.position = cardDeskPosition.transform.position;

        startGameRequest();
    }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
    public IEnumerator openFirstFlopCards()
    {
        if (!gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP).gameObject.activeSelf)
        {
            cardDesk         = dealerPlayer.getCardDeskObject();
            cardDeskPosition = dealerPlayer.getCardDeskPositionObject();
            cardDeskPosition.SetActive(true);
            cardDesk.SetActive(true);
            gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP).gameObject.SetActive(true);

            Image card1 = gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP + GameConstant.UI_PATH_CARD_1).GetComponent <Image> ();
            Image card2 = gameObject.transform.Find(GameConstant.UI_PATH_FIRST_FLOP + GameConstant.UI_PATH_CARD_2).GetComponent <Image> ();
            card1.gameObject.SetActive(false);
            card2.gameObject.SetActive(false);

            cardDesk.transform.position = cardDeskPosition.transform.position;
            cardAnimationManager.MoveCardsObject(cardDesk, card1.gameObject);
            yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

            card1.gameObject.SetActive(true);

            cardDesk.transform.position = cardDeskPosition.transform.position;
            cardAnimationManager.MoveCardsObject(cardDesk, card2.gameObject);
            yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME));

            card2.gameObject.SetActive(true);

            card1.sprite = firstFlop1.getCardSprite();
            card2.sprite = firstFlop2.getCardSprite();

            cardDesk.SetActive(false);
            cardDeskPosition.SetActive(false);
        }
    }