Example #1
0
        // At the drag beginning
        void On_DragStart(Gesture gesture)
        {
            if (realType != GameObjectType.UI)
            {
                if ((!enablePickOverUI && gesture.pickedUIElement == null) || enablePickOverUI)
                {
                    if (gesture.pickedObject == gameObject && !isOnDrag)
                    {
                        isOnDrag = true;

                        fingerIndex = gesture.fingerIndex;

                        // the world coordinate from touch
                        Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position);
                        deltaPosition = position - transform.position;

                        //
                        if (resetPhysic)
                        {
                            if (cachedRigidBody)
                            {
                                cachedRigidBody.isKinematic = true;
                            }

                            if (cachedRigidBody2D)
                            {
                                cachedRigidBody2D.isKinematic = true;
                            }
                        }

                        onDragStart.Invoke(gesture);
                    }
                }
            }
        }
    static int GetTouchToWorldPoint(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <UnityEngine.Vector3>(L, 2))
            {
                HedgehogTeam.EasyTouch.Gesture obj  = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                UnityEngine.Vector3            arg0 = ToLua.ToVector3(L, 2);
                UnityEngine.Vector3            o    = obj.GetTouchToWorldPoint(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <float>(L, 2))
            {
                HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                float arg0            = (float)LuaDLL.lua_tonumber(L, 2);
                UnityEngine.Vector3 o = obj.GetTouchToWorldPoint(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: HedgehogTeam.EasyTouch.Gesture.GetTouchToWorldPoint"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #3
0
 // Token: 0x060002A1 RID: 673 RVA: 0x0000C774 File Offset: 0x0000AB74
 private void On_Drag(Gesture gesture)
 {
     if (this.fingerIndex == gesture.fingerIndex && (this.realType == QuickBase.GameObjectType.Obj_2D || this.realType == QuickBase.GameObjectType.Obj_3D) && gesture.pickedObject == base.gameObject && this.fingerIndex == gesture.fingerIndex)
     {
         Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position) - this.deltaPosition;
         base.transform.position = this.GetPositionAxes(position);
         if (gesture.deltaPosition != Vector2.zero)
         {
             this.onDrag.Invoke(gesture);
         }
         this.lastGesture = gesture;
     }
 }
Example #4
0
        // During the drag
        void On_Drag(Gesture gesture)
        {
            if (fingerIndex == gesture.fingerIndex)
            {
                if (realType == GameObjectType.Obj_2D || realType == GameObjectType.Obj_3D)
                {
                    // Verification that the action on the object
                    if (gesture.pickedObject == gameObject && fingerIndex == gesture.fingerIndex)
                    {
                        // the world coordinate from touch
                        Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position) - deltaPosition;
                        transform.position = GetPositionAxes(position);

                        if (gesture.deltaPosition != Vector2.zero)
                        {
                            onDrag.Invoke(gesture);
                        }
                        lastGesture = gesture;
                    }
                }
            }
        }
Example #5
0
 // Token: 0x060002A0 RID: 672 RVA: 0x0000C680 File Offset: 0x0000AA80
 private void On_DragStart(Gesture gesture)
 {
     if (this.realType != QuickBase.GameObjectType.UI && ((!this.enablePickOverUI && gesture.pickedUIElement == null) || this.enablePickOverUI) && gesture.pickedObject == base.gameObject && !this.isOnDrag)
     {
         this.isOnDrag    = true;
         this.fingerIndex = gesture.fingerIndex;
         Vector3 touchToWorldPoint = gesture.GetTouchToWorldPoint(gesture.pickedObject.transform.position);
         this.deltaPosition = touchToWorldPoint - base.transform.position;
         if (this.resetPhysic)
         {
             if (this.cachedRigidBody)
             {
                 this.cachedRigidBody.isKinematic = true;
             }
             if (this.cachedRigidBody2D)
             {
                 this.cachedRigidBody2D.isKinematic = true;
             }
         }
         this.onDragStart.Invoke(gesture);
     }
 }