コード例 #1
0
ファイル: GestureParser.cs プロジェクト: bmla/SW9_Project
        static public void AddMobileGesture(MobileGesture receivedGesture)
        {
            Console.WriteLine($"{DateTime.Now.ToString("h:mm:ss tt")}: MOBILE: {receivedGesture.Type} {receivedGesture.Direction}");
            if (paused)
            {
                return;
            }
            Logger.CurrentLogger.AddNewMobileGesture(receivedGesture);
            if (receivedGesture.Type == typeContext)
            {
                switch (receivedGesture.Type)
                {
                case GestureType.Swipe: {
                    if (receivedGesture.Direction != GetDirectionContext())
                    {
                        return;
                    }
                    ClearGestures();
                    AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                }
                break;

                case GestureType.Tilt: {
                    ClearGestures();
                    AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                }
                break;

                case GestureType.Pinch: {
                    if (directionContext == receivedGesture.Direction)
                    {
                        if (directionContext == GestureDirection.Push)
                        {
                            if (waitingKinectGesture?.Direction == GestureDirection.Pull)
                            {
                                KinectGesture gesture = waitingKinectGesture;
                                ClearGestures();
                                AwaitingGesture = gesture;
                            }
                            else
                            {
                                ClearGestures();
                                waitingMobileGesture = receivedGesture;
                            }
                        }
                        else
                        {
                            if (waitingKinectGesture != null)
                            {
                                KinectGesture gesture = waitingKinectGesture;
                                ClearGestures();
                                AwaitingGesture = gesture;
                            }
                        }
                    }
                }
                break;

                case GestureType.Throw:
                    if (waitingKinectGesture?.Type == GestureType.Throw)
                    {
                        ClearGestures();
                        AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                    }
                    else
                    {
                        ClearGestures();
                        waitingMobileGesture = receivedGesture;
                    }
                    break;
                }
            }
        }
コード例 #2
0
 public static void ClearGestures()
 {
     waitingKinectGesture = null;
     waitingMobileGesture = null;
     awaitingGesture = null;
 }
コード例 #3
0
ファイル: GestureParser.cs プロジェクト: bmla/SW9_Project
 static public void ClearGestures()
 {
     waitingKinectGesture = null;
     waitingMobileGesture = null;
     awaitingGesture      = null;
 }
コード例 #4
0
 public static void AddMobileGesture(MobileGesture receivedGesture)
 {
     Console.WriteLine($"{DateTime.Now.ToString("h:mm:ss tt")}: MOBILE: {receivedGesture.Type} {receivedGesture.Direction}");
     if (paused) return;
     Logger.CurrentLogger.AddNewMobileGesture(receivedGesture);
     if (receivedGesture.Type == typeContext) {
         switch (receivedGesture.Type) {
             case GestureType.Swipe: {
                     if (receivedGesture.Direction != GetDirectionContext()) return;
                     ClearGestures();
                     AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                 }
                 break;
             case GestureType.Tilt: {
                     ClearGestures();
                     AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                 }
                 break;
             case GestureType.Pinch: {
                     if (directionContext == receivedGesture.Direction) {
                         if (directionContext == GestureDirection.Push) {
                             if (waitingKinectGesture?.Direction == GestureDirection.Pull) {
                                 KinectGesture gesture = waitingKinectGesture;
                                 ClearGestures();
                                 AwaitingGesture = gesture;
                             } else {
                                 ClearGestures();
                                 waitingMobileGesture = receivedGesture;
                             }
                         } else {
                             if(waitingKinectGesture != null) {
                                 KinectGesture gesture = waitingKinectGesture;
                                 ClearGestures();
                                 AwaitingGesture = gesture;
                             }
                         }
                     }
                 }
                 break;
             case GestureType.Throw:
                 if (waitingKinectGesture?.Type == GestureType.Throw) {
                     ClearGestures();
                     AwaitingGesture = new KinectGesture(receivedGesture.Shape);
                 } else {
                     ClearGestures();
                     waitingMobileGesture = receivedGesture;
                 }
                 break;
         }
     }
 }