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;
}
}
}