示例#1
0
    private void ShowCardInHand(UISamPlayer uiPlayer)
    {
        SamCard uiCard = null;
        float   x      = uiPlayer.gCard.transform.position.x;
        float   y      = uiPlayer.gCard.transform.position.y;
        float   z      = uiPlayer.gCard.transform.position.z;
        int     index  = uiPlayers.IndexOf(uiPlayer);
        float   xRange = xCardTableRange;

        if (index == 2)
        {
            x = x - ((uiPlayer._playerData.HandCards.Count - 1) * xRange);
        }

        for (int i = 0; i < uiPlayer._playerData.HandCards.Count; i++)
        {
            uiCard = _cardController.BorrowCard();
            uiCard.LoadData(uiPlayer._playerData.HandCards[i], null, false);
            uiCard.LoadCard();
            uiCard.SetCardPosition(new Vector3(x, y, z), tranTable, 0.7f);
            x += xRange;

            tableCards.Add(uiCard);
        }
    }
示例#2
0
    IEnumerator WaitChiaBai()
    {
        SamCard uiCard = null;

        foreach (var uiPlayer in uiPlayers)
        {
            if (uiPlayer.IsPlaying())
            {
                uiPlayer.ShowCard();
            }
        }

        for (int i = 0; i < uiUser._playerData.HandCards.Count; i++)
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioChiaBai);

            // user
            uiCard = _cardController.BorrowCard();
            uiCard.LoadData(uiUser._playerData.HandCards[i], null, true);
            uiCard.MoveCard(tranWorld.position, tranUserCards[i].position, tranUserCards[i], tranWorld, 1f, false, true);
            userCards.Add(uiCard);

            // player
            foreach (var uiPlayer in uiPlayers)
            {
                if (uiPlayer.IsPlaying() && uiPlayer._playerData.HandCards.Count > i)
                {
                    uiCard = _cardController.BorrowCard();
                    uiCard.LoadData(uiPlayer._playerData.HandCards[i], null, false);
                    uiCard.MoveCard(tranWorld.position, uiPlayer.gCard.transform.position, null, tranWorld, 0.7f, true);

                    uiPlayer.UpdateCardNumber(i + 1);
                }
            }

            yield return(new WaitForSeconds(0.06f));
        }
    }