public void SetDraggedPosition(PointerEventData data)
    {
        MyTweenRectPosition myTween = MaterialController.GetComponent <MyTweenRectPosition>();

        if (myTween == null)
        {
            myTween = MaterialController.gameObject.AddComponent <MyTweenRectPosition>();
        }
        if (ScrollRectTrans.sizeDelta.y < MaterialController.sizeDelta.y)
        {
            MaterialController.sizeDelta = new Vector2(100, ScrollRectTrans.sizeDelta.y + 100);
        }
        else
        {
            MaterialController.sizeDelta = new Vector2(100, MaterialController.sizeDelta.y + 100);
        }
        myTween.from     = Vector2.up * -30f;
        myTween.to       = Vector2.up * 130f;
        myTween.duration = 1;
        if (data.delta.y > 0)
        {
            myTween.SetStartToCurrentValue();
            myTween.to = Vector2.up * 130f;
            myTween.PlayForward();
            return;
        }
        myTween.SetStartToCurrentValue();
        myTween.to = Vector2.up * -30;
        myTween.PlayForward();
    }
 private void onDrag(PointerEventData eventData)
 {
     if (Mathf.Abs(eventData.delta.x) > Mathf.Abs(eventData.delta.y) && isLeftMove)
     {
         myTween = this.GetComponent <MyTweenRectPosition>();
         if (myTween == null)
         {
             myTween = this.gameObject.AddComponent <MyTweenRectPosition>();
         }
         myTween.from     = Vector2.up * itemRect.anchoredPosition.y;
         myTween.to       = new Vector2(-280, itemRect.anchoredPosition.y);
         myTween.duration = 0.25f;
         if (eventData.delta.x > 0)
         {
             myTween.SetStartToCurrentValue();
             myTween.to = Vector2.up * itemRect.anchoredPosition.y;
             myTween.PlayForward();
             if (cancelDeleteFunc != null)
             {
                 cancelDeleteFunc(this);
             }
             return;
         }
         if (deleteTween != null)
         {
             deleteTween(this);
         }
         myTween.SetStartToCurrentValue();
         myTween.to = new Vector2(-280, itemRect.anchoredPosition.y);
         myTween.PlayForward();
         //if (selectDeleteFunc != null) selectDeleteFunc(this);
     }
 }
    private void ShowPage()
    {
        myTween.from     = Vector2.up;
        myTween.duration = 1f;
        myTween.to       = Vector2.right * (-550);

        myTween.SetStartToCurrentValue();
        myTween.to = Vector2.right * (-550);
        myTween.PlayForward();
    }
Exemple #4
0
 public override void enter()
 {
     Debug.Log("群组 状态进入");
     myTween.from     = Vector2.up * groupPage.groupRectTransform.anchoredPosition.y;
     myTween.duration = 1f;
     myTween.to       = -Vector2.right * 550 + Vector2.up * groupPage.groupRectTransform.anchoredPosition.y;
     if (toggleButton.onDown == false)
     {
         setState(EditTypeOnSelect.Free);
         myTween.SetStartToCurrentValue();
         myTween.to = Vector2.up * groupPage.groupRectTransform.anchoredPosition.y;
         myTween.PlayForward();
         return;
     }
     myTween.SetStartToCurrentValue();
     myTween.to = -Vector2.right * 550 + Vector2.up * groupPage.groupRectTransform.anchoredPosition.y;
     myTween.PlayForward();
 }
 public override void enter()
 {
     Debug.Log("选择要打包成组的物体");
     base.enter();
     myTween.from     = Vector2.up;
     myTween.duration = 1f;
     myTween.to       = Vector2.right * (-550);
     if (toggleButton.onDown == false)
     {
         setState(EditTypeOnSelect.Free);
         myTween.SetStartToCurrentValue();
         myTween.to = Vector2.up;
         myTween.PlayForward();
         return;
     }
     myTween.SetStartToCurrentValue();
     myTween.to = Vector2.right * (-550);
     myTween.PlayForward();
     //选择要打包成组的物体
 }
 private void OnScrollDragedEnd(PointerEventData eventData)
 {
     if (tween == null)
     {
         tween = ContentRectTrans.gameObject.AddComponent <MyTweenRectPosition>();
     }
     tween.from     = ContentRectTrans.anchoredPosition;
     tween.to       = ResetPos(eventData);
     tween.duration = 0.5f;
     tween.moveType = MoveType.Linear;
     tween.PlayForward();
 }
    private void GoToPos(RectTransform rectTran, Vector2 pos)
    {
        MyTweenRectPosition mytween = rectTran.GetComponent <MyTweenRectPosition>();

        if (mytween == null)
        {
            mytween = rectTran.gameObject.AddComponent <MyTweenRectPosition>();
        }
        mytween.from = rectTran.anchoredPosition3D;
        mytween.to   = pos;
        mytween.ResetToBeginning();
        mytween.worldSpace = false;
        mytween.duration   = 0.5f;
        mytween.PlayForward();
        //停掉当前动画
        ///开始动画 从当前位置 返回到 本地坐标初始位置
    }
    private void DeleteTween(GenerateOfferItemFunc obj)
    {
        if (obj.myTween == null)
        {
            return;
        }

        if (currentTween == null)
        {
            currentTween = obj.myTween; currentItemRect = obj.itemRect; return;
        }

        currentTween.SetStartToCurrentValue();
        currentTween.to = Vector2.up * currentItemRect.anchoredPosition.y;
        currentTween.PlayForward();
        currentTween    = obj.myTween;
        currentItemRect = obj.itemRect;
    }
    private void goBack(RectTransform rectTran)
    {
        MyTweenRectPosition mytween = rectTran.GetComponent <MyTweenRectPosition>();

        if (mytween == null)
        {
            mytween = rectTran.gameObject.AddComponent <MyTweenRectPosition>();
        }
        mytween.from = rectTran.anchoredPosition3D;
        mytween.to   = Vector2.zero;
        mytween.ResetToBeginning();
        mytween.worldSpace = false;
        mytween.style      = Style.Once;
        mytween.moveType   = MoveType.EaseInOut;
        mytween.duration   = 0.5f;
        mytween.PlayForward();
        //停掉当前动画
        ///开始动画 从当前位置 返回到 本地坐标初始位置
    }
    private void GoToWorldPos(RectTransform rectTran, Vector2 pos)
    {
        MyTweenRectPosition mytween = rectTran.GetComponent <MyTweenRectPosition>();

        if (mytween == null)
        {
            mytween = rectTran.gameObject.AddComponent <MyTweenRectPosition>();
        }
        mytween.from = rectTran.position;
        mytween.to   = pos;
        mytween.ResetToBeginning();
        mytween.worldSpace = true;
        mytween.style      = Style.Once;
        mytween.moveType   = MoveType.EaseInOut;
        mytween.duration   = 0.5f;
        mytween.PlayForward();
        //停掉当前动画
        //动画 从当前位置 去到指定位置
    }