滑动手势识别器不工作
Swipe Gesture Recognizer not working
我是 c# 新手。我需要让我的跳跃动作在不同的方向滑动,每个方向(上、下、右和左)应该 select 在我的超链接 power point 演示文稿上的一些选项(图片导航到下一张幻灯片)。
我正在编写一个简单的 C# 代码来检测这些手势,但它似乎没有打印任何东西或做任何接受连接的事情。
请指出我的代码中没有错误的地方出了什么问题。或者建议我另一种实现方法
using System;
using Leap;
using MotionGestures;
using MotionGestures.Enums;
namespace motrial
{
class LeapListener : Listener
{
public override void OnInit(Controller cntrlr)
{
Console.WriteLine("Initialized");
}
public override void OnConnect(Controller cntrlr)
{
Console.WriteLine("Connected");
}
public override void OnDisconnect(Controller cntrlr)
{
Console.WriteLine("Disconnected");
}
public override void OnExit(Controller cntrlr)
{
Console.WriteLine("Exited");
}
public void motionDidSwipe(MotionSwipeGestureRecognizer recognizer)
{
if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateBegan)
{
Console.WriteLine("Swipe did Begin");
}
else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateChanged)
{
//System.Console.WriteLine("Swipe did Change");
}
else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateEnded)
{
//Handle swipe end
if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft)
{
Console.WriteLine("Swipe Left");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight)
{
Console.WriteLine("Swipe Right");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp)
{
Console.WriteLine("Swipe Up");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown)
{
System.Console.WriteLine("Swipe Down");
}
}
}
}
}
伙计,停止使用那些手势,LM 将它们从 Orion 中删除,因为它们非常不可靠。
如果您真的希望它按预期工作,您将需要构建自己的。
我是 c# 新手。我需要让我的跳跃动作在不同的方向滑动,每个方向(上、下、右和左)应该 select 在我的超链接 power point 演示文稿上的一些选项(图片导航到下一张幻灯片)。
我正在编写一个简单的 C# 代码来检测这些手势,但它似乎没有打印任何东西或做任何接受连接的事情。
请指出我的代码中没有错误的地方出了什么问题。或者建议我另一种实现方法
using System;
using Leap;
using MotionGestures;
using MotionGestures.Enums;
namespace motrial
{
class LeapListener : Listener
{
public override void OnInit(Controller cntrlr)
{
Console.WriteLine("Initialized");
}
public override void OnConnect(Controller cntrlr)
{
Console.WriteLine("Connected");
}
public override void OnDisconnect(Controller cntrlr)
{
Console.WriteLine("Disconnected");
}
public override void OnExit(Controller cntrlr)
{
Console.WriteLine("Exited");
}
public void motionDidSwipe(MotionSwipeGestureRecognizer recognizer)
{
if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateBegan)
{
Console.WriteLine("Swipe did Begin");
}
else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateChanged)
{
//System.Console.WriteLine("Swipe did Change");
}
else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateEnded)
{
//Handle swipe end
if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft)
{
Console.WriteLine("Swipe Left");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight)
{
Console.WriteLine("Swipe Right");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp)
{
Console.WriteLine("Swipe Up");
}
else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown)
{
System.Console.WriteLine("Swipe Down");
}
}
}
}
}
伙计,停止使用那些手势,LM 将它们从 Orion 中删除,因为它们非常不可靠。 如果您真的希望它按预期工作,您将需要构建自己的。