private void Update() { if (!gestureListener) { return; } if (Input.GetKeyDown(KeyCode.PageDown)) { autoFlip.FlipRightPage(); } else if (Input.GetKeyDown(KeyCode.PageUp)) { autoFlip.FlipLeftPage(); } if (gestureListener) { if (gestureListener.IsSwipeLeft()) { autoFlip.FlipRightPage(); } else if (gestureListener.IsSwipeRight()) { autoFlip.FlipLeftPage(); } } }
void judgeFinger() { #if UNITY_EDITOR || (!UNITY_EDITOR && !(UNITY_IPHONE || UNITY_ANDROID)) if (Input.GetKeyDown(KeyCode.Space)) { closedairy(); mDiaryflip.FlipRightPage(); //沿着X轴正方向移动 } #endif //没有触摸 if (Input.touchCount <= 0) { return; } if (Input.touchCount == 1) { if (Input.GetTouch(0).phase == TouchPhase.Began)//(Input.GetKey("mouse 0")) { startFingerPos = Input.GetTouch(0).position; //startFingerPos = Input.mousePosition; } nowFingerPos = Input.GetTouch(0).position; //nowFingerPos = Input.mousePosition; if ((Input.GetTouch(0).phase == TouchPhase.Stationary) || (Input.GetTouch(0).phase == TouchPhase.Ended)) { startFingerPos = nowFingerPos; //Debug.Log("======释放触摸====="); return; } if (startFingerPos == nowFingerPos) { return; } xMoveDistance = Mathf.Abs(nowFingerPos.x - startFingerPos.x); if (xMoveDistance > 100) { if (nowFingerPos.x - startFingerPos.x > 0) { mDiaryflip.FlipLeftPage(); //沿着X轴负方向移动 } else { closedairy(); mDiaryflip.FlipRightPage(); //沿着X轴正方向移动 } } } }
/// <summary> /// 获取触摸移动方向的方法 /// </summary> /// <param name="gesture"></param> public void OnSwipe(SwipeGesture gesture) { // 完整的滑动数据 Vector2 move = gesture.Move; // 滑动的速度 float velocity = gesture.Velocity; // 大概的滑动方向 FingerGestures.SwipeDirection direction = gesture.Direction; if (direction.ToString() == "Left") { Audiomanagement.B_Click_Audio_Source("Turn_over_aBook"); print(direction.ToString()); autoFlip.FlipRightPage(); } else { Audiomanagement.B_Click_Audio_Source("Turn_over_aBook"); print(direction.ToString()); autoFlip.FlipLeftPage(); } }
void FlipToRightPage() { if (BookPro.CurrentPaper >= BookPro.papers.Count - 1) { Button_RigthPage.interactable = true; return; } AutoFlip.FlipRightPage(); }
void JournalSelection() { if (Input.GetKeyDown(KeyCode.LeftArrow)) { bookFlipScript.FlipLeftPage(); } if (Input.GetKeyDown(KeyCode.RightArrow)) { bookFlipScript.FlipRightPage(); } }
// Update is called once per frame void Update() { if (SwipeManager.IsSwipingLeft()) { Debug.Log("swiped left "); book.FlipRightPage(); } if (SwipeManager.IsSwipingRight()) { Debug.Log("swiped right "); book.FlipLeftPage(); } // OR if (SwipeManager.IsSwiping()) { // do something } }
void Update() { //Debug.Log(cursor); timeCount -= Time.deltaTime; if (Input.GetKeyDown(KeyCode.K) && timeCount <= 0) { if (!cursorFlag) { AutoFlip.FlipRightPage(); cursor++; cursorFlag = true; timeCount = 1f; } else { cursor++; cursorFlag = false; } } if (Input.GetKeyDown(KeyCode.D) && timeCount <= 0) { if (!cursorFlag) { cursor--; cursorFlag = true; } else { AutoFlip.FlipLeftPage(); cursor--; cursorFlag = false; timeCount = 1f; } } if (Input.GetKeyDown(KeyCode.J)) { toPlayGameSongName = SongSelect.SongName[cursor - 1]; SceneManager.LoadScene("PlayGame"); } int pageLength = songLength + 1; if (cursor > pageLength) { cursor = pageLength + 1; } else if (cursor <= 0) { cursor = 0; } if (cursor == 0 && cursor != pageLength || cursor == 4 || cursor == 5) { LeftMusicInfo.SetActive(false); RightMusicInfo.SetActive(false); LeftCursor.SetActive(false); RightCursor.SetActive(false); } else if (cursor % 2 == 1 && cursor != pageLength) { LeftMusicInfo.SetActive(true); RightMusicInfo.SetActive(true); LeftCursor.SetActive(true); RightCursor.SetActive(false); } else if (cursor % 2 == 0 && cursor != pageLength) { LeftMusicInfo.SetActive(true); RightMusicInfo.SetActive(true); LeftCursor.SetActive(false); RightCursor.SetActive(true); } if (Input.GetKey(KeyCode.Escape)) { Quit(); } }
public void OnChangePage(bool isNext) { if (isNext) { if (m_Book.bookPages.Length > m_Book.currentPage + 1) { pdfViewr.AddSpriteRequire(m_Book.currentPage + 1, (x) => m_Book.bookPages[m_Book.currentPage + 1] = x); } if (m_Book.bookPages.Length > m_Book.currentPage + 2) { pdfViewr.AddSpriteRequire(m_Book.currentPage + 2, (x) => { m_Book.bookPages[m_Book.currentPage + 2] = x; m_Flip.FlipRightPage(); }); } } else { m_Flip.FlipLeftPage(); } }
void FlipPage() { _book.FlipRightPage(); }