private void HandleAccelEvent(EmulatorAccelEvent accelEvent)
 {
     lock (state)
     {
         state.accel = ConvertEmulatorAccel(accelEvent.value);
     }
 }
 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;
   }
 }
Beispiel #3
0
 private void onAccelEvent(EmulatorAccelEvent e)
 {
     currentAccelEvent = e;
     if (accelEventListenersInternal != null)
     {
         accelEventListenersInternal(e);
     }
 }
 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 onAccelEvent(EmulatorAccelEvent e)
 {
     currentAccelEvent = e;
       if (accelEventListenersInternal != null) {
     accelEventListenersInternal(e);
       }
 }
 private void HandleAccelEvent(EmulatorAccelEvent accelEvent) {
   lock (state) {
     state.accel = ConvertEmulatorAccel(accelEvent.value);
   }
 }