Example #1
0
    //创建牌
    void CreateCards(Transform parentTrans, List <Card> cards, bool isSort)
    {
        List <Card> temp = cards;

        if (isSort)
        {
            temp.Sort((a, b) =>
            {
                int a_count = cards.FindAll(p => p.GetCardWeight == a.GetCardWeight).Count;
                int b_count = cards.FindAll(p => p.GetCardWeight == b.GetCardWeight).Count;
                if (a_count > b_count)
                {
                    return(-1);
                }
                else if (a_count < b_count)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });
        }
        for (int i = 0; i < temp.Count; i++)
        {
            CardUI a = LandlordsPage.MakeSprite(temp[i], false, parentTrans);
            a.SetCardSize(new Vector2(145, 190));
        }
        ani.Play();
    }
    void Play()
    {
        Rest();
        for (int i = 0; i < cardType; i++)
        {
            Transform chiledTrans = transform.GetChild(i);
            int       index       = Index(i + 1, cardType);
            chiledTrans.localPosition  = new Vector3(0, chiledTrans.localPosition.y, 0);
            chiledTrans.localPosition += Vector3.up * i * 7;
            CommonAnimation chiledAni = chiledTrans.gameObject.AddComponent <CommonAnimation>();
            chiledAni.angleList.Add(chiledTrans.localEulerAngles);
            chiledAni.angleList.Add(Vector3.forward * 20 * index);
            chiledAni.angleDelayTime = 0.5f;
            chiledAni.time           = 0.2f;
            chiledAni.Play();
        }

        int posIndex = 1;

        for (int i = cardType; i < transform.childCount; i++)
        {
            Transform chiledTrans = transform.GetChild(i);
            chiledTrans.localPosition += Vector3.right * (200 + posIndex++ *(chiledTrans as RectTransform).sizeDelta.x / 2);
        }
    }
Example #3
0
    // 角度布局
    void AngleLayout(int angleCardNumber)
    {
        Vector3 anglePos = Vector3.zero;

        for (int i = 0; i < angleCardNumber; i++)
        {
            Transform chiledTrans = curParentTrans.GetChild(i);
            chiledTrans.localPosition = Vector3.zero;
            int index = Index(i + 1, angleCardNumber);
            chiledTrans.localPosition += Vector3.left * 200 + Vector3.up * i * 7;
            CommonAnimation chiledAni = chiledTrans.gameObject.AddComponent <CommonAnimation>();
            chiledAni.angleList.Add(chiledTrans.localEulerAngles);
            chiledAni.angleList.Add(Vector3.forward * 20 * index);
            chiledAni.angleDelayTime = 0.2f;
            chiledAni.time           = 0.1f;
            chiledAni.Play();
            anglePos = chiledTrans.localPosition;
        }



        int posIndex = 1;

        for (int i = angleCardNumber; i < curParentTrans.childCount; i++)
        {
            Transform chiledTrans = curParentTrans.GetChild(i);
            chiledTrans.localPosition = new Vector3(anglePos.x, 0, 0) + Vector3.right * 200 + (Vector3.right * posIndex++ *(chiledTrans as RectTransform).sizeDelta.x / 2.5f);
        }
    }
    /// <summary>
    /// 设置倍数显示
    /// </summary>
    /// <param name="ratio"></param>
    IEnumerator SetRatioLb(int ratio)
    {
        ratioLb.gameObject.SetActive(true);
        ratioLb.text = "x" + ratio;
        yield return(new WaitForSecondsRealtime(1.5f));

        CommonAnimation commonAni = ratioLb.GetComponent <CommonAnimation>();

        commonAni.Play();
        commonAni.pointEndAction = () => ratioLb.gameObject.SetActive(false);
    }
Example #5
0
    private void PlayAnim()
    {
        arrow.rotation *= Quaternion.Euler(new Vector3(0, 0, 180));
        if (!isPlay)
        {
            isPlay = true;

            anim.sizeList.Clear();
            anim.sizeList.Add(new Vector2(1240, 100));
            anim.sizeList.Add(new Vector2(1240, contentRect.rect.height + 200));
            anim.Play();
        }
        else
        {
            isPlay = false;
            anim.sizeList.Clear();
            anim.sizeList.Add(new Vector2(1240, contentRect.rect.height + 200));
            anim.sizeList.Add(new Vector2(1240, 100));
            anim.Play();
        }
    }
Example #6
0
    public void Move(Vector3 targetPoint)
    {
        CommonAnimation ca = GetComponent <CommonAnimation>();

        ca.pointList.Clear();
        ca.pointList.Add(transform.localPosition);
        if (transform.localPosition.x - targetPoint.x > MaJangScene.mjSize.x * 2)
        {
            ca.pointList.Add(transform.localPosition + Vector3.up * MaJangScene.mjSize.y);
            ca.pointList.Add(targetPoint + Vector3.up * MaJangScene.mjSize.y);
        }
        ca.pointList.Add(targetPoint);
        ca.space = Space.Self;
        ca.time  = 0.25f;
        ca.Play();
    }
Example #7
0
    public void Move(bool toLeft)
    {
        CommonAnimation ca = GetComponent <CommonAnimation>();

        ca.pointList.Clear();
        ca.pointList.Add(transform.localPosition);
        if (toLeft)
        {
            ca.pointList.Add(transform.localPosition + MaJangScene.mjSize.x * Vector3.left);
        }
        else
        {
            ca.pointList.Add(transform.localPosition + MaJangScene.mjSize.x * Vector3.right);
        }
        ca.space = Space.Self;
        ca.time  = 0.25f;
        ca.Play();
    }
Example #8
0
    /// <summary>
    /// 设置滚动
    /// </summary>
    void SetMovePos()
    {
        CommonAnimation anim = curText.gameObject.GetComponent <CommonAnimation>();

        anim.pointList.Clear();
        anim.pointDelayTime = 1f;
        anim.pointList.Add(new Vector2(851, 0));
        anim.pointList.Add(new Vector2(851 - curText.preferredWidth - (content.transform as RectTransform).sizeDelta.x - 30 - 200, 0));
        anim.time = curText.preferredWidth / (curText.preferredWidth) * 5;
        SetVisibel(true);
        curText.gameObject.SetActive(true);
        anim.Play();
        float a = curText.preferredWidth;

        anim.pointEndAction = () =>
        {
            OnMoveEnd();
        };
    }