コード例 #1
0
 public override void OnSwiped(RecyclerView.ViewHolder viewHolder, int direction)
 {
     SwipeLeft?.Invoke(viewHolder, new ClickEventArgs()
     {
         Position = viewHolder.AdapterPosition
     });
 }
コード例 #2
0
 private void MovePlayer(Vector2 deltaDrag)
 {
     if (Mathf.Abs(deltaDrag.x) > Mathf.Abs(deltaDrag.y))
     {
         //// Horizontal
         if (deltaDrag.x > 0)
         {
             // Right
             SwipeRight.Invoke();
         }
         else
         {
             // Left
             SwipeLeft.Invoke();
         }
     }
     else
     {
         //// Vertical
         if (deltaDrag.y > 0)
         {
             // Up
             SwipeUp.Invoke();
         }
         else
         {
             // Down
             SwipeDown.Invoke();
         }
     }
 }
コード例 #3
0
    public void OnPointerUp(PointerEventData e)
    {
        isDown = false;

        if (timer < minSwipeDuration || timer > maxSwipeDuration)
        {
            return;
        }

        Vector2 diff = e.position - startPos;
        float   dist = diff.magnitude;

        if (dist < minSwipeDistance)
        {
            return;
        }

        if (Mathf.Abs(diff.x) < Mathf.Abs(diff.y))
        {
            return;
        }

        if (diff.x > 0)
        {
            SwipeRight?.Invoke();
        }
        else
        {
            SwipeLeft?.Invoke();
        }
    }
コード例 #4
0
ファイル: SwipeStackLayout.cs プロジェクト: GeorGeWzw/Forms
        public void SwipeLeftEvent()
        {
            var para = SwipeLeftCommandParameter ?? CommandParameter;

            if (null != SwipeLeftCommand)
            {
                if (SwipeLeftCommand.CanExecute(para))
                {
                    SwipeLeftCommand.Execute(para);
                }
            }
            else
            {
                SwipeLeft?.Invoke(this, para);
            }
        }
コード例 #5
0
        public void ReleaseTouch()
        {
            IsSwiping = false;

            if (Time.time - startTime > MAX_TIME)
            {
                return;
            }

            if (Mathf.Abs(startPosition.x - endPosition.x) > MIN_HORIZONTAL_DIST)
            {
                var angle = Vector2.Angle(Vector2.left, startPosition - endPosition);
                if (angle < ANGLE_TOLERANCE)
                {
                    SwipeRight?.Invoke();
                }
                else if (180 - angle < ANGLE_TOLERANCE)
                {
                    SwipeLeft?.Invoke();
                }
            }
        }
コード例 #6
0
        public override bool OnJsAlert(WebView view, string url, string message, JsResult result)
        {
            Logger.Log("JS", message);

            if (message.StartsWith("page count: "))
            {
                int pageCount = int.Parse(message.Split(": ")[1]);

                ChapterLoaded?.Invoke(pageCount);
            }

            if (message == "swipe left")
            {
                SwipeLeft?.Invoke();
            }

            if (message == "swipe right")
            {
                SwipeRight?.Invoke();
            }

            if (message == "swipe down")
            {
                SwipeDown?.Invoke();
            }

            if (message.StartsWith("word selected: "))
            {
                string word     = message.Split(": ")[1].Split('|')[0].Trim().ToLower();
                string sentence = message.Split(": ")[1].Split('|')[1].Trim();

                WordSelected?.Invoke(word, sentence);
            }

            result.Cancel();
            return(true);
        }
コード例 #7
0
 public virtual void OnSwipeLeft()
 {
     SwipeLeft?.Invoke();
 }
コード例 #8
0
 public void OnSwipeLeft() =>
 SwipeLeft?.Invoke(this, null);
コード例 #9
0
 private void SwipeDetector_SwipeLeft(float velocity, float angle)
 {
     SwipeLeft.RaiseEvent(this);
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: emhertz/CS130-Project
        static void RunStandaloneTestApplication()
        {
            Console.WriteLine("Welcome to the Cisco Kinect Team 1 Demo Application.");
            Console.WriteLine("First, we will set up a connection to the Kinect.");
            String deviceName = "NuiDeviceFramework.devices.Kinect";
            String dllPath = "NuiDeviceFramework.dll";
            object device = DeviceManager.GetConnection(deviceName, dllPath);

            if (device == null)
            {
                Console.WriteLine("Error occurred connecting to the {0} device.", deviceName);
                Environment.Exit(-1);
            }

            NuiStreamTypes s = NuiStreamTypes.ColorData;
            for (; s <= NuiStreamTypes.AudioData; s++)
            {
                object val = ReflectionUtilities.InvokeMethod(device, "supportsStreamType", new object[] { s });
                if (val is bool && (bool)val == true)
                {
                    Console.WriteLine("Device {0} supports stream type {1}", deviceName, s);
                }
            }

            GestureManager gm = new GestureManager(device);

            /*
            Gesture audioGesture = new MyAudioGesture(device);

            if (!gm.Add(audioGesture))
            {
                Console.WriteLine("Could not add the gesture {0} to the device {1}. Unsupported gesture.", audioGesture, device);
                Environment.Exit(-1);
            }
            */

            Gesture skeletonGestureSL = new SwipeLeft(device);

            if (!gm.Add(skeletonGestureSL))
            {
                Console.WriteLine("Could not add the gesture {0} to the device {1}. Unsupported gesture.", skeletonGestureSL, device);
            }

            /*
            Gesture skeletonGestureB = new Bow(device);
            if (!gm.Add(skeletonGestureB))
            {
                Console.WriteLine("Could not add the gesture {0} to the device {1}. Unsupported gesture.", skeletonGestureB, device);
            }

            Console.WriteLine("You've successfully added a Gesture to the GestureManager!");
            */

            Console.WriteLine("Now the GestureManager will start listening for input.");
            gm.Start();
            List<Gesture> completedGestures;
            for (; ; )
            {
                completedGestures = gm.getCompletedGestures();
                if (completedGestures.Count == 0)
                {
                    //Console.WriteLine("No gesture detected this frame.");
                }
                else
                {
                    break;
                }
            }

            foreach (Gesture ge in completedGestures)
            {
                Console.WriteLine("Gesture {0} successfully detected!", ge);
            }

            Console.WriteLine("The program will now exit.");
        }
コード例 #11
0
 public void OnSwipeLeft()
 {
     SwipeLeft?.Invoke();
 }
コード例 #12
0
 private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
 {
     //left
     SwipeLeft?.Invoke(this, null);
 }
コード例 #13
0
ファイル: Swipable.cs プロジェクト: XaHDpE/pzl3d
 private static void InvokeSwipeLeft(Vector2 delta)
 {
     SwipeLeft?.Invoke(delta);
 }