Пример #1
0
    /// <summary>
    /// 翻牌后移动牌
    /// </summary>
    /// <param name="cards"></param>
    public void SeparateCards(List <int> three)
    {
        Vector3 finalPos = Vector3.zero;

        if (three == null || three.Count <= 0)
        {
            for (int i = 0; i < mHandCard.Count; i++)
            {
                if (SeatId == NiuniuModel.Inst.mMySeatId)
                {
                    finalPos = new Vector3(100 * i * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                }
                else
                {
                    finalPos = new Vector3(50 * i * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                }
                NiuniuHandCard card = mHandCardGid.transform.GetChild(i).GetComponent <NiuniuHandCard>();
                card.Move(finalPos, .5f);//移动到最终位置
            }
        }
        else
        {
            List <int> newThree = new List <int>();
            List <int> newTwo   = new List <int>();
            List <int> result   = new List <int>();


            for (int i = 0; i < three.Count; i++)
            {
                newThree.Add(three[i] - 1);
                if (SeatId == NiuniuModel.Inst.mMySeatId)
                {
                    finalPos = new Vector3(100 * i * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                }
                else
                {
                    finalPos = new Vector3(50 * i * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                }
                NiuniuHandCard card = mHandCardGid.transform.GetChild(newThree[i]).GetComponent <NiuniuHandCard>();
                card.Move(finalPos, .5f);//移动到最终位置
            }

            int temp = 0;

            for (int i = 0; i < mHandCard.Count; i++)
            {
                if (!newThree.Contains(i))
                {
                    newTwo.Add(i);
                    if (SeatId == NiuniuModel.Inst.mMySeatId)
                    {
                        finalPos = new Vector3(100 * (newThree.Count + 1 + temp) * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                    }
                    else
                    {
                        finalPos = new Vector3(50 * (newThree.Count + 1 + temp) * (mHandCardGid.cellWidth / Mathf.Abs(mHandCardGid.cellWidth)), 0, 0);
                    }
                    NiuniuHandCard card = mHandCardGid.transform.GetChild(newTwo[temp]).GetComponent <NiuniuHandCard>();
                    card.Move(finalPos, .5f);//移动到最终位置
                    temp++;
                }
            }
        }
    }
Пример #2
0
 /// <summary>
 /// 发牌延迟移动
 /// </summary>
 /// <param name="card"></param>
 /// <param name="dpos"></param>
 /// <param name="time"></param>
 /// <param name="delayTime"></param>
 /// <param name="isEnlarge"></param>
 private void DealCardMove(NiuniuHandCard card, Vector3 dpos, float time, bool isEnlarge)
 {
     card.Move(dpos, time, isEnlarge);//移动到目标位置
 }