private void MovePlayer(Vector2 deltaDrag) { if (Mathf.Abs(deltaDrag.x) > Mathf.Abs(deltaDrag.y)) { //// Horizontal if (deltaDrag.x > 0) { // Right SwipeRight.Invoke(); } else { // Left SwipeLeft.Invoke(); } } else { //// Vertical if (deltaDrag.y > 0) { // Up SwipeUp.Invoke(); } else { // Down SwipeDown.Invoke(); } } }
public void OnPointerUp(PointerEventData e) { isDown = false; if (timer < minSwipeDuration || timer > maxSwipeDuration) { return; } Vector2 diff = e.position - startPos; float dist = diff.magnitude; if (dist < minSwipeDistance) { return; } if (Mathf.Abs(diff.x) < Mathf.Abs(diff.y)) { return; } if (diff.x > 0) { SwipeRight?.Invoke(); } else { SwipeLeft?.Invoke(); } }
public void SwipeRightEvent() { var para = SwipeRightCommandParameter ?? CommandParameter; if (null != SwipeRightCommand) { if (SwipeRightCommand.CanExecute(para)) { SwipeRightCommand.Execute(para); } } else { SwipeRight?.Invoke(this, para); } }
public void ReleaseTouch() { IsSwiping = false; if (Time.time - startTime > MAX_TIME) { return; } if (Mathf.Abs(startPosition.x - endPosition.x) > MIN_HORIZONTAL_DIST) { var angle = Vector2.Angle(Vector2.left, startPosition - endPosition); if (angle < ANGLE_TOLERANCE) { SwipeRight?.Invoke(); } else if (180 - angle < ANGLE_TOLERANCE) { SwipeLeft?.Invoke(); } } }
public override bool OnJsAlert(WebView view, string url, string message, JsResult result) { Logger.Log("JS", message); if (message.StartsWith("page count: ")) { int pageCount = int.Parse(message.Split(": ")[1]); ChapterLoaded?.Invoke(pageCount); } if (message == "swipe left") { SwipeLeft?.Invoke(); } if (message == "swipe right") { SwipeRight?.Invoke(); } if (message == "swipe down") { SwipeDown?.Invoke(); } if (message.StartsWith("word selected: ")) { string word = message.Split(": ")[1].Split('|')[0].Trim().ToLower(); string sentence = message.Split(": ")[1].Split('|')[1].Trim(); WordSelected?.Invoke(word, sentence); } result.Cancel(); return(true); }
public virtual void OnSwipeRight() { SwipeRight?.Invoke(); }
public void OnSwipeRight() => SwipeRight?.Invoke(this, null);
private void SwipeDetector_SwipeRight(float velocity, float angle) { SwipeRight.RaiseEvent(this); }
private void SwipeGestureRecognizer_Swiped_1(object sender, SwipedEventArgs e) { //right SwipeRight?.Invoke(this, null); }
private static void InvokeSwipeRight(Vector2 delta) { SwipeRight?.Invoke(delta); }