我是c#的新手。我需要让我的跳跃动作在不同的方向上滑动,每个方向(向上,向下,向右和向左)应该在我的超链接功率点演示上选择一些选项(图片导航到下一张幻灯片)。
我正在编写一个简单的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");
}
}
}
}
}
答案 0 :(得分:0)
老兄,停止使用这些手势,LM将它们从猎户座移除,因为它们非常不可靠。 如果你真的想让它按预期工作,你需要建立自己的。