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 bool OnTouch(View v, MotionEvent e) { var checkheight = v.Height <= 0 ? _defaultCheckHeight : v.Height * 0.04; if (e.ActionMasked == MotionEventActions.Move) { if (FirstYPrecision != 0 && SecondYPrecision == 0) { SecondYPrecision = e.GetY(); } if (FirstYPrecision == 0) { FirstYPrecision = e.GetY();; } } if (e.ActionMasked == MotionEventActions.Up) { if (FirstYPrecision != 0 && SecondYPrecision != 0 && (FirstYPrecision - SecondYPrecision) > checkheight) { try { SwipeUp.Invoke(null, null); } catch (Exception ex) { Console.WriteLine("SwipeUp Exeption" + ex.Message); } } if (FirstYPrecision != 0 && SecondYPrecision != 0 && (SecondYPrecision - FirstYPrecision) > 0) { try { SwipeDown.Invoke(null, null); } catch (Exception ex) { Console.WriteLine("SwipeDown Exeption" + ex.Message); } } FirstYPrecision = 0; SecondYPrecision = 0; } return(false); }
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 void OnSwipeDown() { SwipeDown?.Invoke(this, null); }
private static void InvokeSwipeDown(Vector2 delta) { SwipeDown?.Invoke(delta); }