Пример #1
0
        /// <summary>
        /// Handles the GestureRecognized event of the g control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="KinectSkeltonTracker.GestureEventArgs"/> instance containing the event data.</param>
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            if (this.GestureRecognized != null)
            {
                this.GestureRecognized(this, e);
            }

            foreach (Gesture g in this.gestures)
            {
                g.Reset();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Gesture event arguments.</param>
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            switch (e.GestureName)
            {
                case "Menu":
                    break;
                case "WaveRight":
                    break;
                case "WaveLeft":
                    break;
                case "JoinedHands":
                    //Gesture = "Joined Hands";
                    break;
                case "SwipeLeft":
                   // Gesture = "Swipe Left";
                    break;
                case "SwipeRight":
                    //Gesture = "Swipe Right";
                    break;
                case "SwipeUp":
                   // Gesture = "Swipe Up";
                    break;
                case "SwipeDown":
                    //Gesture = "Swipe Down";
                    break;
                case "ZoomIn":
                    //Gesture = "Zoom In";
                    break;
                case "ZoomOut":
                    //Gesture = "Zoom Out";
                    break;
                case "Surrender":
                    //Gesture = "Surrender";
                    break;

                default:
                    break;
            }

            //_clearTimer.Start();
        }
Пример #3
0
 private void OnGestureRecognized(object sender, GestureEventArgs e)
 {
     var excluelist = Enumerable.Empty<GestureType>();
     foreach (var continuesGesture in _continuesGestures)
     {
         excluelist = excluelist.Concat(continuesGesture.ExcludeGesturesIfTracked);
         continuesGesture.Update(e.GestureType);
     }
     if (_getsturesActions.ContainsKey(e.GestureType) && !excluelist.Contains(e.GestureType))
     {
         var sample = _getsturesActions[e.GestureType];
         sample.Play();
         var message = string.Format("{0} recognized. {1} is playing.", e.GestureType, sample);
         if (this.GestureSamplePlayed != null)
         {
             this.GestureSamplePlayed(this, new GestureSampleArgs
                 {
                     GestureEventArgs = e,
                     Sample = sample,
                     Message = message
                 });
         }
     }
 }
Пример #4
0
 private void OnGestureRecognized(object sender, GestureEventArgs e)
 {
     if (GestureDetected != null)
     {
         switch (e.GestureName)
         {
             case "Menu":
                 GestureDetected(this, GestureType.LeftHandHalfLift);
                 break;
             case "JoinedHands":
                 GestureDetected(this, GestureType.JoinedHands);
                 break;
             case "ZoomIn":
                 GestureDetected(this, GestureType.ZoomIn);
                 break;
             case "ZoomOut":
                 GestureDetected(this, GestureType.ZoomOut);
                 break;
             case "Pull":
             case "PullLeft":
                 GestureDetected(this, GestureType.Pull);
                 break;
             case "Push":
             case "PushLeft":
                 GestureDetected(this, GestureType.Push);
                 break;
         }
     }
 }
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            lock (m_lock)
            {
                GestureFrame gf = new GestureFrame();
                gf.Gesture = e.GestureType;
                gf.IsNew = true;
                this.LastGestures[e.TrackingId] = gf;
            }

            /*switch (e.GestureType)
            {
                case GestureType.Menu:
                    Gesture = "Menu";
                    break;
                case GestureType.WaveRight:
                    Gesture = "Wave Right";
                    break;
                case GestureType.WaveLeft:
                    Gesture = "Wave Left";
                    break;
                case GestureType.JoinedHands:
                    Gesture = "Joined Hands";
                    break;
                case GestureType.SwipeLeft:
                    Gesture = "Swipe Left";
                    break;
                case GestureType.SwipeRight:
                    Gesture = "Swipe Right";
                    break;
                case GestureType.ZoomIn:
                    Gesture = "Zoom In";
                    break;
                case GestureType.ZoomOut:
                    Gesture = "Zoom Out";
                    break;

                default:
                    break;
            }*/
        }
 void gestureController_GestureRecognized(object sender, GestureEventArgs e)
 {
     if (GestureDetected != null)
         GestureDetected(this, new GestureArgs(e.GestureName, e.TrackingId));
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Gesture event arguments.</param>
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            switch (e.GestureName)
            {
                case "JoinedHandsAnywhere":
                    Gesture = "Joined Hands Anywhere";
                    break;
                default:
                    break;
            }

            clearTimer.Start();
        }
Пример #8
0
 protected override void gestureRecognizedInvoker(GestureEventArgs e)
 {
     base.gestureRecognizedInvoker(e);
 }
        private void gestureRecognition(object p_sender, GestureEventArgs p_args)
        {
            // Handle recognised gesture arguments:
            string temp_gesture_str = "";
            GestureType temp_gesture = GestureType.NONE;

            switch (p_args.GestureName)
            {
                case "Menu":
                    {
                        temp_gesture_str = "Menu Gesture";
                        temp_gesture = GestureType.MENU;
                        break;
                    }
                case "WaveRight":
                    {
                        temp_gesture_str = "Wave Right Hand";
                        temp_gesture = GestureType.WAVE_RIGHT_HAND;
                        break;
                    }
                case "WaveLeft":
                    {
                        temp_gesture_str = "Wave Left Hand";
                        temp_gesture = GestureType.WAVE_LEFT_HAND;
                        break;
                    }
                case "JoinedHands":
                    {
                        temp_gesture_str = "Joined Hands";
                        temp_gesture = GestureType.JOINED_HANDS;
                        break;
                    }
                case "SwipeLeft":
                    {
                        temp_gesture_str = "Swipe Right Hand (To The Left)";
                        temp_gesture = GestureType.SWIPE_RIGHT_TO_LEFT;
                        break;
                    }
                case "SwipeRight":
                    {
                        temp_gesture_str = "Swipe Left Hand (To The Right)";
                        temp_gesture = GestureType.SWIPE_LEFT_TO_RIGHT;
                        break;
                    }
                case "SwipeUp":
                    {
                        temp_gesture_str = "Swipe Up";
                        temp_gesture = GestureType.SWIPE_UP;
                        break;
                    }
                case "SwipeDown":
                    {
                        temp_gesture_str = "Swipe Down";
                        temp_gesture = GestureType.SWIPE_DOWN;
                        break;
                    }
                case "ZoomIn":
                    {
                        temp_gesture_str = "Zoom In (Move Hands Apart)";
                        temp_gesture = GestureType.ZOOM_IN;
                        break;
                    }
                case "ZoomOut":
                    {
                        temp_gesture_str = "Zoom Out (Move Hands Together)";
                        temp_gesture = GestureType.ZOOM_OUT;
                        break;
                    }
                default:
                    {
                        temp_gesture_str = "";
                        break;
                    }
            }

            if (this.skeleton_players.ContainsKey(p_args.TrackingId) &&
                this.skeleton_players[p_args.TrackingId] != null)
            {
                //var current_skeleton = this.skeleton_players[p_args.TrackingId];

                if(this.skeleton_players[p_args.TrackingId].last_gesture_str != temp_gesture_str &&
                   this.PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Gesture"));
                }

                this.skeleton_players[p_args.TrackingId].last_gesture_str = temp_gesture_str;
                this.skeleton_players[p_args.TrackingId].last_gesture = temp_gesture;
            }

            this.clear_timer.Start();
        }
Пример #10
0
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            //TODO Connect gesture type to appropriate action
            switch (e.GestureType)
            {
                case GestureType.Menu:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Menu");
                    break;
                case GestureType.WaveRight:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Baloons +10");
                    game.baloons = game.baloons + 10;
                    break;
                case GestureType.WaveLeft:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Baloons -10");
                    game.baloons = game.baloons - 10;
                    break;
                case GestureType.JoinedHands:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Joined hands");
                    game.ClearPlayField();
                    game.StartGame();
                    break;
                case GestureType.SwipeLeft:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Swipe left");
                    break;
                case GestureType.SwipeRight:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Swipe right");
                    break;
                case GestureType.ZoomIn:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Zoom in");
                    break;
                case GestureType.ZoomOut:
                    FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Zoom out");
                    break;

                default:
                    break;
            }
        }