Ejemplo n.º 1
0
    public void Play(string id, normalDele dele, int cardCount)
    {
        rectTransform.localPosition    = localPosition;
        rectTransform.localEulerAngles = localEulerAngles;
        rectTransform.localScale       = Vector3.one;
        gameObject.SetActive(true);
        image.overrideSprite = cover;
        cardSprite           = StaticMethod.GetCardSprite(id, true);
        isMove = true;
        Tweener t = image.rectTransform.DOLocalRotate(targetEulerAngles, 0.2f);

        float val = cardCount > 7 ? x * 8 : x * (cardCount + 1);

        if (!isMy)
        {
            val = -val;
        }
        Tweener t1 = image.rectTransform.DOLocalMove(new Vector3(val, targetPosition.y, targetPosition.z), 0.2f);
        Tweener t2 = image.rectTransform.DOScale(new Vector3(1.5f, 1.5f, 1), 0.3f);

        t1.onComplete = delegate
        {
            isMove = false;
            gameObject.SetActive(false);
            if (dele != null)
            {
                dele();
            }
        };
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 卡图由小变大
    /// </summary>
    /// <param name="card"></param>
    /// <param name="dele"></param>
    public void ShowAnim(Card card, normalDele dele)
    {
        image.rectTransform.localScale = Vector3.one;
        image.overrideSprite           = StaticMethod.GetCardSprite(card.cardID, false);
        this.gameObject.SetActive(true);

        Tweener tweener = image.rectTransform.DOScale(Vector3.one * 3, 0.2f);

        tweener.SetEase(Ease.Linear);

        tweener.onComplete = delegate()
        {
            Tweener tweener1 = image.rectTransform.DOScale(Vector3.one * 3, 0.2f);
            tweener1.SetEase(Ease.Linear);

            tweener1.onComplete = delegate()
            {
                image.transform.localScale = Vector3.one;
                this.gameObject.SetActive(false);
                if (dele != null)
                {
                    dele();
                }
            };
        };
    }
Ejemplo n.º 3
0
 void Update()
 {
     //if (Input.GetKeyDown(KeyCode.A) && isMy)
     //{
     //    PlayAnim("00213326", ComVal.Area_Monster, ComVal.Area_Hand, ComVal.CardPutType_UpRightFront, -1, 1, toRank);
     //}
     if (isInAnim && !isChange)
     {
         if (toType == ComVal.CardPutType_layBack || toType == ComVal.CardPutType_UpRightBack)
         {
             if (rectTransform.localEulerAngles.y > 100)
             {
                 isChange     = true;
                 image.sprite = StaticMethod.GetCardSprite("0", true);
             }
         }
     }
 }
Ejemplo n.º 4
0
 void Awake()
 {
     image             = transform.GetComponent <Image>();
     rectTransform     = transform.GetComponent <RectTransform>();
     cover             = StaticMethod.GetCardSprite("0", true);
     localEulerAngles  = rectTransform.localEulerAngles;
     localPosition     = rectTransform.localPosition;
     targetPosition    = target.localPosition;
     targetEulerAngles = target.localEulerAngles;
     gameObject.SetActive(false);
     x = target.sizeDelta.x / 2;
     if (this.name == "ODrawCardAnim")
     {
         isMy = false;
     }
     else
     {
         isMy = true;
     }
 }
Ejemplo n.º 5
0
    /// <summary>
    /// 发动效果时动画
    /// </summary>
    /// <param name="card"></param>
    /// <param name="dele"></param>
    /// <param name="effect"></param>
    public void ShowEffectAnim(Card card, normalDele dele)
    {
        image.rectTransform.localScale = Vector3.one * 3;
        image.overrideSprite           = StaticMethod.GetCardSprite(card.cardID, false);
        gameObject.SetActive(true);

        Vector2 pos      = image.rectTransform.sizeDelta;
        Vector3 startPos = new Vector3(-pos.x / 2, pos.y / 2, 0);

        Vector3 endPos = new Vector3(pos.x / 2, -pos.y / 2, 0);

        imageRect.localPosition = startPos;
        Tweener tweener = imageRect.DOLocalMove(endPos, 0.2f);

        tweener.SetEase(Ease.Linear);
        tweener.onComplete = delegate()
        {
            if (dele != null)
            {
                gameObject.SetActive(false);
                dele();
            }
        };
    }
Ejemplo n.º 6
0
    public void PlayAnim(string cardID, int fromArea, int toArea, int fromType, int toType, int fromRank = -1, int toRank = -1)
    {
        float speed = 0.2f;

        this.fromArea = fromArea;
        this.toArea   = toArea;
        this.fromType = fromType;
        this.toType   = toType;

        isInAnim = true;
        isChange = false;

        if (duel.IsNetWork)
        {
            if (isMy)
            {
                image.sprite = StaticMethod.GetCardSprite(cardID, true);
            }
            else
            {
                image.sprite = StaticMethod.GetCardSprite("0", true);
            }
        }
        else
        {
            image.sprite = StaticMethod.GetCardSprite("0", true);
        }



        gameObject.SetActive(true);
        targetRect = GetRect(fromArea, fromRank);
        rectTransform.anchoredPosition3D = targetRect.anchoredPosition3D;

        rectTransform.localEulerAngles = targetRect.localEulerAngles;
        rectTransform.localScale       = Vector3.one;
        if (fromArea.IsBind(ComVal.Area_Field) || fromArea.IsBind(ComVal.Area_InSummon))
        {
            rectTransform.localEulerAngles.Set(rectTransform.localEulerAngles.x, GetRotationY(fromType), GetRotationZ(fromType));
        }
        if (fromArea.IsBind(ComVal.Area_Hand))
        {
            rectTransform.anchoredPosition3D = targetRect.anchoredPosition3D + targetRect.parent.GetComponent <RectTransform>().anchoredPosition3D;
            rectTransform.localScale         = new Vector3(1.5f, 1.5f, 1.5f);
        }

        Vector3 targetPosition = Vector3.zero;
        Vector3 targetRotation = Vector3.zero;
        Vector3 targetScale    = Vector3.one;

        if (toArea.IsBind(ComVal.Area_Field))
        {
            targetPosition = GetRect(toArea, toRank).anchoredPosition3D;
            targetRotation.Set(rectTransform.localEulerAngles.x, GetRotationY(toType), GetRotationZ(toType));
        }
        else if (toArea.IsBind(ComVal.Area_Hand))
        {
            targetPosition = GetReturnHandCardPos(toRank) + duelUIMgr.GetHandCardUI(isMy).anchoredPosition3D;
            targetRotation = new Vector3(-35, 0, 0);
            targetScale    = new Vector3(1.5f, 1.5f, 1.5f);
        }
        else
        {
            targetPosition = GetRect(toArea, toRank).anchoredPosition3D;
            targetRotation = GetRect(toArea, toRank).localEulerAngles;
        }

        Tweener t  = rectTransform.DOLocalMove(targetPosition, speed);
        Tweener t1 = rectTransform.DOLocalRotate(targetRotation, speed);
        Tweener t2 = rectTransform.DOScale(targetScale, speed);

        t.onComplete = FinishAnim;
    }