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();
    }
Beispiel #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 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;
    }