示例#1
0
    /// <summary>
    /// 用于单纯同步数据
    /// </summary>
    /// <param name="type"></param>
    /// <param name="list"></param>
    void RefreshPlayerCards(EPlayerPositionType type, List <uint> list, bool isLast)
    {
        ClearPutOutingCard(type);
        Transform parentContainer = GetCardsParentPosContainer(type);
        float     PosY            = 0;

        if (EPlayerPositionType.ESelf == type)
        {
            PosY = GlobalData.mSelectCardToTargetPos.y;
        }
        else if (EPlayerPositionType.ERight == type && isLast)
        {
            PosY = -100;
        }

        List <SingleCard> singleCardList = new List <SingleCard>();

        if (list.Count > 0)
        {
            int count = list.Count;
            for (int i = 0; i < count; i++)
            {
                GameObject item = GameObject.Instantiate(singleCardPrefab) as GameObject;
                item.transform.SetParent(parentContainer);
                item.transform.localPosition = new Vector3(GetOtherCardsPos(type, i, count).x, PosY, 0);
                item.transform.localScale    = isLast ? Vector3.one * 0.5f : Vector3.one;
                SingleCard singleCard = item.transform.GetComponent <SingleCard>();
                singleCard.SetOtherData(list[i], type, true);
                singleCardList.Add(singleCard);
            }
        }
        else
        {
            GameObject item = GameObject.Instantiate(singleCardPrefab) as GameObject;
            item.transform.SetParent(parentContainer);
            item.transform.localPosition = new Vector3(GetOtherCardsPos(type, 0, 1).x, PosY, 0);
            item.transform.localScale    = isLast ? Vector3.one * 0.5f : Vector3.one;
            SingleCard singleCard = item.transform.GetComponent <SingleCard>();
            singleCard.SetOtherData(GlobalData.mRefuseCardNumId, type, true);
        }
        if (isLast)
        {
            List <List <SingleCard> > cardDic = new List <List <SingleCard> >();
            SelfCardsManager.Instance.InitRefreshRealCardDic(singleCardList, cardDic);
            SetLastCardPosAndDepth(cardDic); // 刷新底部牌
        }
    }
示例#2
0
    void SetPlayerCardsPos(EPlayerPositionType type, List <uint> list, TGuanDanCT putOutType)
    {
        //他人出牌只用于显示
        Transform   parentContainer = GetCardsParentPosContainer(type);
        EAudioStyle audioStyle      = RoomInfo.Instance.GetPlayerAudioStyleByPlayerPos(type);

        //PlayTween
        TweenManager.Instance.PlayCardTween(putOutType, parentContainer);

        if (putOutType != TGuanDanCT.CT_BUCHU)
        {
            AudioManager.Instance.PlayEffectAudio(SelfCardsManager.Instance.GetCardAudioFileName(putOutType, list[0], audioStyle));
            //Debug.LogError("玩家位置:"+type.ToString()+"玩家的音效类型:"+audioStyle);
            int count = list.Count;
            for (int i = 0; i < count; i++)
            {
                GameObject item = Instantiate(singleCardPrefab);
                item.transform.SetParent(parentContainer);
                item.transform.localPosition = GetOtherCardsPos(type, i, count);
                item.transform.localScale    = Vector3.one;
                SingleCard singleCard = item.transform.GetComponent <SingleCard>();
                singleCard.SetOtherData(list[i], type, false);
            }
        }
        else if (putOutType == TGuanDanCT.CT_BUCHU)
        {
            AudioManager.Instance.PlayEffectAudio(SelfCardsManager.Instance.GetCardAudioFileName(putOutType, 0, audioStyle));
            //Debug.LogError("玩家位置:" + type.ToString() + "玩家的音效类型:" + audioStyle);
            // mRefuseCardNumId 为 不要的牌 id ,这里把自己的不出也当做别人的不出
            GameObject item = GameObject.Instantiate(singleCardPrefab) as GameObject;
            item.transform.SetParent(parentContainer);
            item.transform.localPosition = GetOtherCardsPos(type, 0, 1);
            item.transform.localScale    = Vector3.one;
            SingleCard singleCard = item.transform.GetComponent <SingleCard>();
            singleCard.SetOtherData(GlobalData.mRefuseCardNumId, type, false);
        }
    }