Beispiel #1
0
        private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(IntPtr result, IntPtr pNative)
        {
            List <EventHandler <PropertyChangedEventArgs> > list = null;

            BodyFrameSource.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out list);
            object obj = list;

            lock (obj)
            {
                BodyFrameSource          objThis = NativeObjectCache.GetObject <BodyFrameSource>(pNative);
                PropertyChangedEventArgs args    = new PropertyChangedEventArgs(result);
                using (List <EventHandler <PropertyChangedEventArgs> > .Enumerator enumerator = list.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        EventHandler <PropertyChangedEventArgs> func = enumerator.Current;
                        EventPump.Instance.Enqueue(delegate
                        {
                            try
                            {
                                func(objThis, args);
                            }
                            catch
                            {
                            }
                        });
                    }
                }
            }
        }
Beispiel #2
0
 // Token: 0x06002B23 RID: 11043 RVA: 0x000D9A76 File Offset: 0x000D7E76
 public void OverrideHandTracking(ulong oldTrackingId, ulong newTrackingId)
 {
     if (this._pNative == IntPtr.Zero)
     {
         throw new ObjectDisposedException("BodyFrameSource");
     }
     BodyFrameSource.Windows_Kinect_BodyFrameSource_OverrideHandTracking_1(this._pNative, oldTrackingId, newTrackingId);
     ExceptionHelper.CheckLastError();
 }
Beispiel #3
0
 // Token: 0x06002B0F RID: 11023 RVA: 0x000D94A8 File Offset: 0x000D78A8
 private void Dispose(bool disposing)
 {
     if (this._pNative == IntPtr.Zero)
     {
         return;
     }
     this.__EventCleanup();
     NativeObjectCache.RemoveObject <BodyFrameSource>(this._pNative);
     BodyFrameSource.Windows_Kinect_BodyFrameSource_ReleaseObject(ref this._pNative);
     this._pNative = IntPtr.Zero;
 }
Beispiel #4
0
        // Token: 0x06002B1F RID: 11039 RVA: 0x000D99D0 File Offset: 0x000D7DD0
        public BodyFrameReader OpenReader()
        {
            if (this._pNative == IntPtr.Zero)
            {
                throw new ObjectDisposedException("BodyFrameSource");
            }
            IntPtr intPtr = BodyFrameSource.Windows_Kinect_BodyFrameSource_OpenReader(this._pNative);

            ExceptionHelper.CheckLastError();
            if (intPtr == IntPtr.Zero)
            {
                return(null);
            }
            return(NativeObjectCache.CreateOrGetObject <BodyFrameReader>(intPtr, (IntPtr n) => new BodyFrameReader(n)));
        }
Beispiel #5
0
        // Token: 0x06002B24 RID: 11044 RVA: 0x000D9AAC File Offset: 0x000D7EAC
        private void __EventCleanup()
        {
            BodyFrameSource.Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(this._pNative);
            List <EventHandler <FrameCapturedEventArgs> > list = BodyFrameSource.Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[this._pNative];
            object obj = list;

            lock (obj)
            {
                if (list.Count > 0)
                {
                    list.Clear();
                    if (this._pNative != IntPtr.Zero)
                    {
                        IntPtr pNative = this._pNative;
                        if (BodyFrameSource.f__mg2 == null)
                        {
                            BodyFrameSource.f__mg2 = new BodyFrameSource._Windows_Kinect_FrameCapturedEventArgs_Delegate(BodyFrameSource.Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler);
                        }
                        BodyFrameSource.Windows_Kinect_BodyFrameSource_add_FrameCaptured(pNative, BodyFrameSource.f__mg2, true);
                    }
                    BodyFrameSource._Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle.Free();
                }
            }
            BodyFrameSource.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(this._pNative);
            List <EventHandler <PropertyChangedEventArgs> > list2 = BodyFrameSource.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[this._pNative];
            object obj2 = list2;

            lock (obj2)
            {
                if (list2.Count > 0)
                {
                    list2.Clear();
                    if (this._pNative != IntPtr.Zero)
                    {
                        IntPtr pNative2 = this._pNative;
                        if (BodyFrameSource.f__mg3 == null)
                        {
                            BodyFrameSource.f__mg3 = new BodyFrameSource._Windows_Data_PropertyChangedEventArgs_Delegate(BodyFrameSource.Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
                        }
                        BodyFrameSource.Windows_Kinect_BodyFrameSource_add_PropertyChanged(pNative2, BodyFrameSource.f__mg3, true);
                    }
                    BodyFrameSource._Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
                }
            }
        }
Beispiel #6
0
    //Methof to initialise your kinect
    void InitKinect()
    {
        _getsureBasePath = Path.Combine(Application.streamingAssetsPath, "GestureDB/JumpDB.gbd");
        _dbGestures      = VisualGestureBuilderDatabase.Create(_getsureBasePath);
        _bodies          = new Windows.Kinect.Body[6];
        _kinect          = Windows.Kinect.KinectSensor.GetDefault();
        _kinect.Open();
        _gestureFrameSource = VisualGestureBuilderFrameSource.Create(_kinect, 0);

        //for each gesture in trained database of custom gestures - add them to kinect frame source
        foreach (Gesture gest in _dbGestures.AvailableGestures)
        {
            _gestureFrameSource.AddGesture(gest);
            if (gest.Name == "Jump")
            {
                _jump = gest;
            }
            else if (gest.Name == "Lean_Left")
            {
                _moveLeft = gest;
            }
            else if (gest.Name == "Lean_Right")
            {
                _moveRight = gest;
            }
            else if (gest.Name == "Swing")
            {
                _swing = gest;
            }
        }
        _bodyFrameSource = _kinect.BodyFrameSource;
        _bodyFrameReader = _bodyFrameSource.OpenReader();
        _bodyFrameReader.FrameArrived += _bodyFrameReader_FrameArrived;

        _gestureFrameReader               = _gestureFrameSource.OpenReader();
        _gestureFrameReader.IsPaused      = true;
        _gestureFrameReader.FrameArrived += _gestureFrameReader_FrameArrived;
    }
Beispiel #7
0
 // Token: 0x06002B0A RID: 11018 RVA: 0x000D9455 File Offset: 0x000D7855
 internal BodyFrameSource(IntPtr pNative)
 {
     this._pNative = pNative;
     BodyFrameSource.Windows_Kinect_BodyFrameSource_AddRefObject(ref this._pNative);
 }