//IBeginDragHandler public void OnBeginDrag(PointerEventData eventData) { //Get the absolute values of the x and y differences so we can see which one is bigger and scroll the other scroll rect accordingly float horizontal = Mathf.Abs(eventData.position.x - eventData.pressPosition.x); float vertical = Mathf.Abs(eventData.position.y - eventData.pressPosition.y); if (isScrollOtherHorizontally) { if (horizontal > vertical) { isScrollOther = true; //disable the current scroll rect so it doesnt move. mScrollRect.enabled = false; ParentScrollRect.OnBeginDrag(eventData); // Send Begin Drag EventMoveScrollView.SendBeginDrag(); } } else if (vertical > horizontal) { isScrollOther = true; //disable the current scroll rect so it doesnt move. mScrollRect.enabled = false; ParentScrollRect.OnBeginDrag(eventData); } }
private void ClickBtPre() { AudioAssistant.Instance.Shot(StringHelper.SOUND_GATE_BT); if (scrollViewController.indexCurrentScroll == 0) { return; } EventMoveScrollView.RequestGoToLayout(scrollViewController.indexCurrentScroll - 1); }
private void ClickBtNext() { AudioAssistant.Instance.Shot(StringHelper.SOUND_GATE_BT); if (scrollViewController.indexCurrentScroll == listTypeJackpot.Count - 1) { return; } EventMoveScrollView.RequestGoToLayout(scrollViewController.indexCurrentScroll + 1); }
//IEndDragHandler public void OnEndDrag(PointerEventData eventData) { if (isScrollOther) { isScrollOther = false; mScrollRect.enabled = true; ParentScrollRect.OnEndDrag(eventData); // Send End Drag EventMoveScrollView.SendEndDrag(ParentScrollRect.velocity.x); } }