bool FireEvent(FingerMotionEvent e, EventType eventType, FingerMotionPhase phase, Vector2 position, bool updateSelection)
    {
        if ((!TrackMove && eventType == EventType.Move) || (!TrackStationary && eventType == EventType.Stationary))
        {
            return(false);
        }

        e.Phase    = phase;
        e.Position = position;

        if (e.Phase == FingerMotionPhase.Started)
        {
            e.StartTime = Time.time;
        }

        if (updateSelection)
        {
            UpdateSelection(e);
        }

        if (eventType == EventType.Move)
        {
            e.Name = MoveMessageName;

            if (OnFingerMove != null)
            {
                OnFingerMove(e);
            }

            TrySendMessage(e);
        }
        else if (eventType == EventType.Stationary)
        {
            e.Name = StationaryMessageName;

            if (OnFingerStationary != null)
            {
                OnFingerStationary(e);
            }

            TrySendMessage(e);
        }
        else
        {
            Debug.LogWarning("Unhandled FingerMotionDetector event type: " + eventType);
            return(false);
        }

        return(true);
    }
Beispiel #2
0
 MotionEventPhase MotionPhaseConvertor(FingerMotionPhase phase)
 {
     if (phase == FingerMotionPhase.None)
     {
         return(MotionEventPhase.None);
     }
     else if (phase == FingerMotionPhase.Started)
     {
         return(MotionEventPhase.Started);
     }
     else if (phase == FingerMotionPhase.Updated)
     {
         return(MotionEventPhase.Updated);
     }
     else
     {
         return(MotionEventPhase.Ended);
     }
 }