static int GetCurrentPickedObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                UnityEngine.GameObject         o   = obj.GetCurrentPickedObject();
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2)
            {
                HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
                UnityEngine.GameObject o = obj.GetCurrentPickedObject(arg0);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: HedgehogTeam.EasyTouch.Gesture.GetCurrentPickedObject"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #2
0
        public Gesture GetGesture()
        {
            Gesture gesture = new Gesture();
            gesture.fingerIndex = fingerIndex;
            gesture.touchCount = touchCount;
            gesture.startPosition = startPosition;
            gesture.position = position;
            gesture.deltaPosition = deltaPosition;
            gesture.actionTime = actionTime;
            gesture.deltaTime = deltaTime;
            gesture.isOverGui = isOverGui;

            gesture.pickedCamera = pickedCamera;
            gesture.pickedObject = pickedObject;
            gesture.isGuiCamera = isGuiCamera;

            gesture.pickedUIElement = pickedUIElement;

            #if UNITY_5_3
            gesture.altitudeAngle = altitudeAngle;
            gesture.azimuthAngle = azimuthAngle;
            gesture.maximumPossiblePressure = maximumPossiblePressure;
            gesture.pressure = pressure;
            gesture.radius = radius;
            gesture.radiusVariance = radiusVariance;
            gesture.touchType = touchType;
            #endif

            return 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));
        }
    }
    static int IsOverRectTransform(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                HedgehogTeam.EasyTouch.Gesture obj  = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                UnityEngine.RectTransform      arg0 = (UnityEngine.RectTransform)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform));
                bool o = obj.IsOverRectTransform(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 3)
            {
                HedgehogTeam.EasyTouch.Gesture obj  = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
                UnityEngine.RectTransform      arg0 = (UnityEngine.RectTransform)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform));
                UnityEngine.Camera             arg1 = (UnityEngine.Camera)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera));
                bool o = obj.IsOverRectTransform(arg0, arg1);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: HedgehogTeam.EasyTouch.Gesture.IsOverRectTransform"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #5
0
 public void twistRouter(HedgehogTeam.EasyTouch.Gesture gesture)
 {
     Debug.Log("t");
     if (isDeleting || isRenaming || chosenRouter == null)
     {
         return;
     }
     chosenRouter.transform.parent.gameObject.transform.Rotate(0, gesture.twistAngle, 0);
 }
 static int NormalizedPosition(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
         UnityEngine.Vector2            o   = obj.NormalizedPosition();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetSwipeOrDragAngle(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
         float o = obj.GetSwipeOrDragAngle();
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Clone(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
         object o = obj.Clone();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetGesture(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HedgehogTeam.EasyTouch.BaseFinger obj = (HedgehogTeam.EasyTouch.BaseFinger)ToLua.CheckObject <HedgehogTeam.EasyTouch.BaseFinger>(L, 1);
         HedgehogTeam.EasyTouch.Gesture    o   = obj.GetGesture();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int IsOverUIElement(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)ToLua.CheckObject <HedgehogTeam.EasyTouch.Gesture>(L, 1);
         bool o = obj.IsOverUIElement();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_twoFingerDistance(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)o;
            float ret = obj.twoFingerDistance;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index twoFingerDistance on a nil value"));
        }
    }
    static int get_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            HedgehogTeam.EasyTouch.Gesture           obj = (HedgehogTeam.EasyTouch.Gesture)o;
            HedgehogTeam.EasyTouch.EasyTouch.EvtType ret = obj.type;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"));
        }
    }
    static int set_swipeVector(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            HedgehogTeam.EasyTouch.Gesture obj  = (HedgehogTeam.EasyTouch.Gesture)o;
            UnityEngine.Vector2            arg0 = ToLua.ToVector2(L, 2);
            obj.swipeVector = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index swipeVector on a nil value"));
        }
    }
    static int set_twoFingerDistance(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            HedgehogTeam.EasyTouch.Gesture obj = (HedgehogTeam.EasyTouch.Gesture)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.twoFingerDistance = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index twoFingerDistance on a nil value"));
        }
    }
    static int set_type(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            HedgehogTeam.EasyTouch.Gesture           obj  = (HedgehogTeam.EasyTouch.Gesture)o;
            HedgehogTeam.EasyTouch.EasyTouch.EvtType arg0 = (HedgehogTeam.EasyTouch.EasyTouch.EvtType)ToLua.CheckObject(L, 2, typeof(HedgehogTeam.EasyTouch.EasyTouch.EvtType));
            obj.type = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"));
        }
    }
    static int _CreateHedgehogTeam_EasyTouch_Gesture(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                HedgehogTeam.EasyTouch.Gesture obj = new HedgehogTeam.EasyTouch.Gesture();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: HedgehogTeam.EasyTouch.Gesture.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #17
0
        private void CreateGesture2Finger(EvtType message,Vector2 startPosition,Vector2 position,Vector2 deltaPosition,
	                                   float actionTime, SwipeDirection swipe, float swipeLength,Vector2 swipeVector,float twist,float pinch, float twoDistance)
        {
            bool firingEvent = true;
            Gesture gesture = new Gesture();
            gesture.isOverGui = false;

            // NGui
            if (enabledNGuiMode && message == EvtType.On_TouchStart2Fingers){
            gesture.isOverGui = gesture.isOverGui || ( IsTouchOverNGui(twoFinger.position) && IsTouchOverNGui(twoFinger.position));
            }

            gesture.touchCount=2;
            gesture.fingerIndex=-1;
            gesture.startPosition = startPosition;
            gesture.position = position;
            gesture.deltaPosition = deltaPosition;

            gesture.actionTime = actionTime;
            gesture.deltaTime=Time.deltaTime;

            gesture.swipe = swipe;
            gesture.swipeLength = swipeLength;
            gesture.swipeVector = swipeVector;

            gesture.deltaPinch = pinch;
            gesture.twistAngle = twist;
            gesture.twoFingerDistance = twoDistance;

            gesture.pickedObject = twoFinger.pickedObject;
            gesture.pickedCamera = twoFinger.pickedCamera;
            gesture.isGuiCamera= twoFinger.isGuiCamera;

            if (autoUpdatePickedObject){
            if (message != EvtType.On_Drag && message != EvtType.On_DragEnd && message != EvtType.On_Twist && message != EvtType.On_TwistEnd && message != EvtType.On_Pinch && message != EvtType.On_PinchEnd
             && message != EvtType.On_PinchIn && message != EvtType.On_PinchOut){

                if (GetTwoFingerPickedObject()){
                    gesture.pickedObject = pickedObject.pickedObj;
                    gesture.pickedCamera = pickedObject.pickedCamera;
                    gesture.isGuiCamera= pickedObject.isGUI;
                }
                else{
                    twoFinger.ClearPickedObjectData();
                }
            }
            }

            gesture.pickedUIElement = twoFinger.pickedUIElement;
            gesture.isOverGui = twoFinger.isOverGui;

            if (allowUIDetection && autoUpdatePickedUI){
            if (message != EvtType.On_Drag && message != EvtType.On_DragEnd && message != EvtType.On_Twist && message != EvtType.On_TwistEnd && message != EvtType.On_Pinch && message != EvtType.On_PinchEnd
                && message != EvtType.On_PinchIn && message != EvtType.On_PinchOut){
                if (message == EvtType.On_SimpleTap2Fingers)

                if (GetTwoFingerPickedUIElement()){
                    gesture.pickedUIElement = pickedObject.pickedObj;
                    gesture.isOverGui = true;
                }
                else{
                    twoFinger.ClearPickedUIData();
                }
            }
            }

            // Firing event ?
            if ((enableUIMode || (enabledNGuiMode && allowUIDetection) ) ){
            firingEvent = !gesture.isOverGui;
            }

            // Firing event
            if ( firingEvent){
            RaiseEvent(message, gesture);
            }
            else if (gesture.isOverGui){
            if (message == EvtType.On_TouchUp2Fingers){
                RaiseEvent(EvtType.On_UIElementTouchUp, gesture);
            }
            else{
                RaiseEvent(EvtType.On_OverUIElement, gesture);
            }
            }
        }
Пример #18
0
 void On_SwipeEnd2Fingers(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_SwipeEnd2Fingers, gesture);
 }
Пример #19
0
 void On_DragStart2Fingers(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_DragStart2Fingers, gesture);
 }
Пример #20
0
 void On_Twist(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_Twist, gesture);
 }
        // Token: 0x060002CC RID: 716 RVA: 0x0000D5E0 File Offset: 0x0000B9E0
        private bool isRightDirection(Gesture gesture)
        {
            float num = -1f;

            if (this.inverseAxisValue)
            {
                num = 1f;
            }
            this.axisActionValue = 0f;
            switch (this.swipeDirection)
            {
            case QuickSwipe.SwipeDirection.Vertical:
                if (gesture.swipe == EasyTouch.SwipeDirection.Up || gesture.swipe == EasyTouch.SwipeDirection.Down)
                {
                    this.axisActionValue = gesture.deltaPosition.y * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.Horizontal:
                if (gesture.swipe == EasyTouch.SwipeDirection.Left || gesture.swipe == EasyTouch.SwipeDirection.Right)
                {
                    this.axisActionValue = gesture.deltaPosition.x * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.DiagonalRight:
                if (gesture.swipe == EasyTouch.SwipeDirection.UpRight || gesture.swipe == EasyTouch.SwipeDirection.DownLeft)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.DiagonalLeft:
                if (gesture.swipe == EasyTouch.SwipeDirection.UpLeft || gesture.swipe == EasyTouch.SwipeDirection.DownRight)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.Up:
                if (gesture.swipe == EasyTouch.SwipeDirection.Up)
                {
                    this.axisActionValue = gesture.deltaPosition.y * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.UpRight:
                if (gesture.swipe == EasyTouch.SwipeDirection.UpRight)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.Right:
                if (gesture.swipe == EasyTouch.SwipeDirection.Right)
                {
                    this.axisActionValue = gesture.deltaPosition.x * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.DownRight:
                if (gesture.swipe == EasyTouch.SwipeDirection.DownRight)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.Down:
                if (gesture.swipe == EasyTouch.SwipeDirection.Down)
                {
                    this.axisActionValue = gesture.deltaPosition.y * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.DownLeft:
                if (gesture.swipe == EasyTouch.SwipeDirection.DownLeft)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.Left:
                if (gesture.swipe == EasyTouch.SwipeDirection.Left)
                {
                    this.axisActionValue = gesture.deltaPosition.x * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.UpLeft:
                if (gesture.swipe == EasyTouch.SwipeDirection.UpLeft)
                {
                    this.axisActionValue = gesture.deltaPosition.magnitude * num;
                    return(true);
                }
                break;

            case QuickSwipe.SwipeDirection.All:
                this.axisActionValue = gesture.deltaPosition.magnitude * num;
                return(true);
            }
            this.axisActionValue = 0f;
            return(false);
        }
Пример #22
0
 void On_DoubleTap2Fingers(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_DoubleTap2Fingers, gesture);
 }
Пример #23
0
 void On_PinchEnd(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_PinchEnd, gesture);
 }
Пример #24
0
 void On_OverUIElement(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_OverUIElement, gesture);
 }
Пример #25
0
 void On_UIElementTouchUp(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_UIElementTouchUp, gesture);
 }
Пример #26
0
        private void TriggerScheduler(EasyTouch.EvtType evnt, Gesture gesture)
        {
            foreach (EasyTouchReceiver receiver in receivers)
            {
                if (receiver.enable && receiver.eventName == evnt)
                {
                    if (
                        (receiver.restricted && ((gesture.pickedObject == gameObject && receiver.triggerType == ETTType.Object3D) || (gesture.pickedUIElement == gameObject && receiver.triggerType == ETTType.UI)))

                        || (!receiver.restricted && (receiver.gameObject == null || ((receiver.gameObject == gesture.pickedObject && receiver.triggerType == ETTType.Object3D) || (gesture.pickedUIElement == receiver.gameObject && receiver.triggerType == ETTType.UI))))

                        )
                    {
                        GameObject sender = gameObject;
                        if (receiver.otherReceiver && receiver.gameObjectReceiver != null)
                        {
                            sender = receiver.gameObjectReceiver;
                        }
                        switch (receiver.parameter)
                        {
                        case ETTParameter.None:
                            sender.SendMessage(receiver.methodName, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.ActionTime:
                            sender.SendMessage(receiver.methodName, gesture.actionTime, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Delta_Pinch:
                            sender.SendMessage(receiver.methodName, gesture.deltaPinch, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Delta_Position:
                            sender.SendMessage(receiver.methodName, gesture.deltaPosition, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.DeltaTime:
                            sender.SendMessage(receiver.methodName, gesture.deltaTime, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Finger_Id:
                            sender.SendMessage(receiver.methodName, gesture.fingerIndex, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Gesture:
                            sender.SendMessage(receiver.methodName, gesture, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.PickedObject:
                            if (gesture.pickedObject != null)
                            {
                                sender.SendMessage(receiver.methodName, gesture.pickedObject, SendMessageOptions.DontRequireReceiver);
                            }
                            break;

                        case ETTParameter.PickedUIElement:
                            if (gesture.pickedUIElement != null)
                            {
                                sender.SendMessage(receiver.methodName, gesture.pickedObject, SendMessageOptions.DontRequireReceiver);
                            }
                            break;

                        case ETTParameter.Position:
                            sender.SendMessage(receiver.methodName, gesture.position, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Start_Position:
                            sender.SendMessage(receiver.methodName, gesture.startPosition, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Swipe_Length:
                            sender.SendMessage(receiver.methodName, gesture.swipeLength, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Swipe_Type:
                            sender.SendMessage(receiver.methodName, gesture.swipe, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Swipe_Vector:
                            sender.SendMessage(receiver.methodName, gesture.swipeVector, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Touch_Count:
                            sender.SendMessage(receiver.methodName, gesture.touchCount, SendMessageOptions.DontRequireReceiver);
                            break;

                        case ETTParameter.Twist_Anlge:
                            sender.SendMessage(receiver.methodName, gesture.twistAngle, SendMessageOptions.DontRequireReceiver);
                            break;
                        }
                    }
                }
            }
        }
Пример #27
0
 void On_TouchDown(Gesture gesture)
 {
     if (realType != GameObjectType.UI)
     {
         if ((!enablePickOverUI && gesture.GetCurrentFirstPickedUIElement() == null) || enablePickOverUI)
         {
             if (gesture.GetCurrentPickedObject() == gameObject)
             {
                 if (!fingerOver[gesture.fingerIndex] && ((!isOnTouch && !isMultiTouch) || isMultiTouch))
                 {
                     fingerOver[gesture.fingerIndex] = true;
                     onTouchEnter.Invoke(gesture);
                     isOnTouch = true;
                 }
                 else if (fingerOver[gesture.fingerIndex])
                 {
                     onTouchOver.Invoke(gesture);
                 }
             }
             else
             {
                 if (fingerOver[gesture.fingerIndex])
                 {
                     fingerOver[gesture.fingerIndex] = false;
                     onTouchExit.Invoke(gesture);
                     if (!isMultiTouch)
                     {
                         isOnTouch = false;
                     }
                 }
             }
         }
         else
         {
             if (gesture.GetCurrentPickedObject() == gameObject && (!enablePickOverUI && gesture.GetCurrentFirstPickedUIElement() != null))
             {
                 if (fingerOver[gesture.fingerIndex])
                 {
                     fingerOver[gesture.fingerIndex] = false;
                     onTouchExit.Invoke(gesture);
                     if (!isMultiTouch)
                     {
                         isOnTouch = false;
                     }
                 }
             }
         }
     }
     else
     {
         if (gesture.GetCurrentFirstPickedUIElement() == gameObject)
         {
             if (!fingerOver[gesture.fingerIndex] && ((!isOnTouch && !isMultiTouch) || isMultiTouch))
             {
                 fingerOver[gesture.fingerIndex] = true;
                 onTouchEnter.Invoke(gesture);
                 isOnTouch = true;
             }
             else if (fingerOver[gesture.fingerIndex])
             {
                 onTouchOver.Invoke(gesture);
             }
         }
         else
         {
             if (fingerOver[gesture.fingerIndex])
             {
                 fingerOver[gesture.fingerIndex] = false;
                 onTouchExit.Invoke(gesture);
                 if (!isMultiTouch)
                 {
                     isOnTouch = false;
                 }
             }
         }
     }
 }
Пример #28
0
 void On_TouchDown2Fingers(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_TouchDown2Fingers, gesture);
 }
Пример #29
0
 public void OnSwipe(HedgehogTeam.EasyTouch.Gesture _a)
 {
     //Debug.Log(string.Format("x={0} y={1}", _a.deltaPosition.x, _a.deltaPosition.y));
     m_Camera.transform.localPosition += new Vector3(_a.deltaPosition.x * -1.0f, _a.deltaPosition.y * -0.0f, 0.0f) * scale;
 }
Пример #30
0
 void LateUpdate()
 {
     // single gesture
     if (_currentGestures.Count>1){
     _currentGestures.RemoveAt(0);
     }
     else{
     _currentGestures[0] = new Gesture();
     }
     _currentGesture = _currentGestures[0];
 }
Пример #31
0
        private void RaiseEvent(EvtType evnt, Gesture gesture)
        {
            gesture.type = evnt;

            switch(evnt){
            case EvtType.On_Cancel:
                if (On_Cancel!=null)
                    On_Cancel( gesture);
                break;
            case EvtType.On_Cancel2Fingers:
                if (On_Cancel2Fingers!=null)
                    On_Cancel2Fingers( gesture );
                break;
            case EvtType.On_TouchStart:
                if (On_TouchStart!=null)
                    On_TouchStart( gesture);
                break;
            case EvtType.On_TouchDown:
                if (On_TouchDown!=null)
                    On_TouchDown( gesture);
                break;
            case EvtType.On_TouchUp:
                if (On_TouchUp!=null)
                    On_TouchUp( gesture );
                break;
            case EvtType.On_SimpleTap:
                if (On_SimpleTap!=null)
                    On_SimpleTap( gesture);
                break;
            case EvtType.On_DoubleTap:
                if (On_DoubleTap!=null)
                    On_DoubleTap(gesture);
                break;
            case EvtType.On_LongTapStart:
                if (On_LongTapStart!=null)
                    On_LongTapStart(gesture);
                break;
            case EvtType.On_LongTap:
                if (On_LongTap!=null)
                    On_LongTap(gesture);
                break;
            case EvtType.On_LongTapEnd:
                if (On_LongTapEnd!=null)
                    On_LongTapEnd(gesture);
                break;
            case EvtType.On_DragStart:
                if (On_DragStart!=null)
                    On_DragStart(gesture);
                break;
            case EvtType.On_Drag:
                if (On_Drag!=null)
                    On_Drag(gesture);
                break;
            case EvtType.On_DragEnd:
                if (On_DragEnd!=null)
                    On_DragEnd(gesture);
                break;
            case EvtType.On_SwipeStart:
                if (On_SwipeStart!=null)
                    On_SwipeStart( gesture);
                break;
            case EvtType.On_Swipe:
                if (On_Swipe!=null)
                    On_Swipe( gesture);
                break;
            case EvtType.On_SwipeEnd:
                if (On_SwipeEnd!=null)
                    On_SwipeEnd(gesture);
                break;
            case EvtType.On_TouchStart2Fingers:
                if (On_TouchStart2Fingers!=null)
                    On_TouchStart2Fingers( gesture);
                break;
            case EvtType.On_TouchDown2Fingers:
                if (On_TouchDown2Fingers!=null)
                    On_TouchDown2Fingers(gesture);
                break;
            case EvtType.On_TouchUp2Fingers:
                if (On_TouchUp2Fingers!=null)
                    On_TouchUp2Fingers(gesture);
                break;
            case EvtType.On_SimpleTap2Fingers:
                if (On_SimpleTap2Fingers!=null)
                    On_SimpleTap2Fingers(gesture);
                break;
            case EvtType.On_DoubleTap2Fingers:
                if (On_DoubleTap2Fingers!=null)
                    On_DoubleTap2Fingers(gesture);
                break;
            case EvtType.On_LongTapStart2Fingers:
                if (On_LongTapStart2Fingers!=null)
                    On_LongTapStart2Fingers(gesture);
                break;
            case EvtType.On_LongTap2Fingers:
                if (On_LongTap2Fingers!=null)
                    On_LongTap2Fingers(gesture);
                break;
            case EvtType.On_LongTapEnd2Fingers:
                if (On_LongTapEnd2Fingers!=null)
                    On_LongTapEnd2Fingers(gesture);
                break;
            case EvtType.On_Twist:
                if (On_Twist!=null)
                    On_Twist(gesture);
                break;
            case EvtType.On_TwistEnd:
                if (On_TwistEnd!=null)
                    On_TwistEnd(gesture);
                break;
            case EvtType.On_Pinch:
                if (On_Pinch!=null)
                    On_Pinch(gesture);
                break;
            case EvtType.On_PinchIn:
                if (On_PinchIn!=null)
                    On_PinchIn(gesture);
                break;
            case EvtType.On_PinchOut:
                if (On_PinchOut!=null)
                    On_PinchOut(gesture);
                break;
            case EvtType.On_PinchEnd:
                if (On_PinchEnd!=null)
                    On_PinchEnd(gesture);
                break;
            case EvtType.On_DragStart2Fingers:
                if (On_DragStart2Fingers!=null)
                    On_DragStart2Fingers(gesture);
                break;
            case EvtType.On_Drag2Fingers:
                if (On_Drag2Fingers!=null)
                    On_Drag2Fingers(gesture);
                break;
            case EvtType.On_DragEnd2Fingers:
                if (On_DragEnd2Fingers!=null)
                    On_DragEnd2Fingers(gesture);
                break;
            case EvtType.On_SwipeStart2Fingers:
                if (On_SwipeStart2Fingers!=null)
                    On_SwipeStart2Fingers(gesture);
                break;
            case EvtType.On_Swipe2Fingers:
                if (On_Swipe2Fingers!=null)
                    On_Swipe2Fingers(gesture);
                break;
            case EvtType.On_SwipeEnd2Fingers:
                if (On_SwipeEnd2Fingers!=null)
                    On_SwipeEnd2Fingers(gesture);
                break;
            case EvtType.On_OverUIElement:
                if (On_OverUIElement!=null){
                    On_OverUIElement(gesture);
                }
                break;
            case EvtType.On_UIElementTouchUp:
                if (On_UIElementTouchUp!=null){
                    On_UIElementTouchUp( gesture);
                }
                break;
            }

            // Direct Acces
            int result = _currentGestures.FindIndex( delegate(Gesture obj) {
            return obj.type == gesture.type && obj.fingerIndex == gesture.fingerIndex;
            }
            );

            if (result>-1){
            _currentGestures[result].touchCount = gesture.touchCount;
            _currentGestures[result].position = gesture.position;
            _currentGestures[result].actionTime = gesture.actionTime;
            _currentGestures[result].pickedCamera = gesture.pickedCamera;
            _currentGestures[result].pickedObject = gesture.pickedObject;
            _currentGestures[result].pickedUIElement = gesture.pickedUIElement;
            _currentGestures[result].isOverGui = gesture.isOverGui;
            _currentGestures[result].isGuiCamera = gesture.isGuiCamera;

            // Update delta from current
            _currentGestures[result].deltaPinch += gesture.deltaPinch;
            _currentGestures[result].deltaPosition += gesture.deltaPosition;

            _currentGestures[result].deltaTime += gesture.deltaTime;
            _currentGestures[result].twistAngle += gesture.twistAngle;
            }

            if (result==-1 ){
            _currentGestures.Add( (Gesture)gesture.Clone());
            if (_currentGestures.Count>0){
                _currentGesture = _currentGestures[0];
            }
            }
        }
Пример #32
0
 void On_Drag(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_Drag, gesture);
 }
Пример #33
0
 void On_Swipe(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_Swipe, gesture);
 }
Пример #34
0
 void On_Cancel(Gesture gesture)
 {
     TriggerScheduler(EasyTouch.EvtType.On_Cancel, gesture);
 }