void mipTap(Vector2 position) { if ((System.DateTime.Now - timeLastReset).TotalMilliseconds < FingerUpTimeOut) { return; } MoverioTouchpadEventArgs args = new MoverioTouchpadEventArgs(MoverioTouchpadEventType.Tap); args.Position = position; args.Origin = position; args.Last = position; MessageBroker.BroadcastAll("OnTap", args); System.DateTime tapTime = System.DateTime.Now; if ((tapTime - lastTapTime).TotalMilliseconds < TapTimeOut) { args = new MoverioTouchpadEventArgs(MoverioTouchpadEventType.DoubleTap); args.Position = position; args.Origin = position; args.Last = position; MessageBroker.BroadcastAll("OnDoubleTap", args); } lastTapTime = tapTime; }
void mipTouchMoved(Vector2 position, Vector2 origin, Vector2 last) { MoverioTouchpadEventArgs args = new MoverioTouchpadEventArgs(MoverioTouchpadEventType.TouchMoved); args.Position = position; args.Origin = origin; args.Last = last; MessageBroker.BroadcastAll("OnTouchMoved", args); }
void mipTouchStarted(Vector2 position) { if (!touchStarted) { touchStarted = true; if ((System.DateTime.Now - timeLastReset).TotalMilliseconds < FingerUpTimeOut) { return; } MoverioTouchpadEventArgs args = new MoverioTouchpadEventArgs(MoverioTouchpadEventType.TouchStarted); args.Position = position; args.Origin = position; args.Last = position; MessageBroker.BroadcastAll("OnTouchStarted", args); } }
void mipTouchEnded(Vector2 position, Vector2 origin, System.TimeSpan lenght) { if (touchStarted) { touchStarted = false; if ((System.DateTime.Now - timeLastReset).TotalMilliseconds < FingerUpTimeOut) { return; } MoverioTouchpadEventArgs args = new MoverioTouchpadEventArgs(MoverioTouchpadEventType.TouchEnded); args.Position = position; args.Origin = origin; args.Duration = lenght; MessageBroker.BroadcastAll("OnTouchEnded", args); if (isAndroid && resetMousePointerOnTouchEnded) { if (!isJNIInitialized) { CommToAndroid.CallAndroidMethod("setDisplaySize", Screen.width, Screen.height); CommToAndroid.CallAndroidMethod("openMouseCursor", "UnityMoverioBT200"); isJNIInitialized = true; } else { CommToAndroid.CallAndroidMethod("mouseMove", -1, -1); CommToAndroid.CallAndroidMethod("mouseMove", 180, 100); } touchOrigin = Input.mousePosition; touchLastPosition = Input.mousePosition; timeLastReset = System.DateTime.Now; } } }
void OnDoubleTap(MoverioTouchpadEventArgs args) { SetBaselineRotation(); }