private void ProcessEventAtEndOfFrame(PhoneEvent e) {
   switch (e.Type) {
     case PhoneEvent.Types.Type.MOTION:
       EmulatorTouchEvent touchEvent = new EmulatorTouchEvent(e.MotionEvent, lastDownTimeMs);
       onTouchEvent(touchEvent);
       if (touchEvent.getActionMasked() == EmulatorTouchEvent.Action.kActionDown) {
         lastDownTimeMs = e.MotionEvent.Timestamp;
       }
       break;
     case PhoneEvent.Types.Type.GYROSCOPE:
       EmulatorGyroEvent gyroEvent = new EmulatorGyroEvent(e.GyroscopeEvent);
       onGyroEvent(gyroEvent);
       break;
     case PhoneEvent.Types.Type.ACCELEROMETER:
       EmulatorAccelEvent accelEvent = new EmulatorAccelEvent(e.AccelerometerEvent);
       onAccelEvent(accelEvent);
       break;
     case PhoneEvent.Types.Type.ORIENTATION:
       EmulatorOrientationEvent orientationEvent =
           new EmulatorOrientationEvent(e.OrientationEvent);
       onOrientationEvent(orientationEvent);
       break;
     case PhoneEvent.Types.Type.KEY:
       EmulatorButtonEvent buttonEvent = new EmulatorButtonEvent(e.KeyEvent);
       onButtonEvent(buttonEvent);
       break;
     default:
       Debug.Log("Unsupported PhoneEvent type: " + e.Type);
       break;
   }
 }
Esempio n. 2
0
 private void onOrientationEvent(EmulatorOrientationEvent e)
 {
     currentOrientationEvent = e;
     if (orientationEventListenersInternal != null)
     {
         orientationEventListenersInternal(e);
     }
 }
Esempio n. 3
0
 private void HandleOrientationEvent(EmulatorOrientationEvent orientationEvent)
 {
     lastRawOrientation = ConvertEmulatorQuaternion(orientationEvent.orientation);
     if (!initialRecenterDone)
     {
         Recenter();
         initialRecenterDone = true;
     }
     lock (state) {
         state.orientation = yawCorrection * lastRawOrientation;
     }
 }
 private void ProcessEventAtEndOfFrame(PhoneEvent e)
 {
     switch (e.Type) {
     case PhoneEvent.Types.Type.MOTION:
       EmulatorTouchEvent touchEvent = new EmulatorTouchEvent(e.MotionEvent, lastDownTimeMs);
       onTouchEvent(touchEvent);
       if (touchEvent.getActionMasked() == EmulatorTouchEvent.Action.kActionDown) {
     lastDownTimeMs = e.MotionEvent.Timestamp;
       }
       break;
     case PhoneEvent.Types.Type.GYROSCOPE:
       EmulatorGyroEvent gyroEvent = new EmulatorGyroEvent(e.GyroscopeEvent);
       onGyroEvent(gyroEvent);
       break;
     case PhoneEvent.Types.Type.ACCELEROMETER:
       EmulatorAccelEvent accelEvent = new EmulatorAccelEvent(e.AccelerometerEvent);
       onAccelEvent(accelEvent);
       break;
     case PhoneEvent.Types.Type.ORIENTATION:
       EmulatorOrientationEvent orientationEvent =
       new EmulatorOrientationEvent(e.OrientationEvent);
       onOrientationEvent(orientationEvent);
       break;
     case PhoneEvent.Types.Type.KEY:
       EmulatorButtonEvent buttonEvent = new EmulatorButtonEvent(e.KeyEvent);
       onButtonEvent(buttonEvent);
       break;
     default:
       Debug.Log("Unsupported PhoneEvent type: " + e.Type);
       break;
       }
 }
 private void onOrientationEvent(EmulatorOrientationEvent e)
 {
     currentOrientationEvent = e;
       if (orientationEventListenersInternal != null) {
     orientationEventListenersInternal(e);
       }
 }
 private void HandleOrientationEvent(EmulatorOrientationEvent orientationEvent) {
   lastRawOrientation = ConvertEmulatorQuaternion(orientationEvent.orientation);
   if (!initialRecenterDone) {
     Recenter();
     initialRecenterDone = true;
   }
   lock (state) {
     state.orientation = yawCorrection * lastRawOrientation;
   }
 }