public void OnInitializePotentialDrag(PointerEventData eventData)
        {
            ScrollRect targetScrollRect  = targetCarousel.GetComponent <ScrollRect>();
            GameObject contentGameObject = targetScrollRect.content.gameObject;
            GameObject clickedGameObject = eventData.pointerCurrentRaycast.gameObject;

            if (
                (clickedGameObject == contentGameObject) ||
                (clickedGameObject == targetCarousel.gameObject) ||
                (clickedGameObject.transform.IsChildOf(contentGameObject.transform))
                )
            {
                targetCarousel.OnInitializePotentialDrag(eventData);
                CarouselRotator carouselRotator = targetCarousel.GetComponent <CarouselRotator>();
                if (carouselRotator)
                {
                    carouselRotator.OnBeginDrag(eventData);
                }
                targetDrag = true;
            }
        }
        public void OnEndDrag(PointerEventData eventData)
        {
            if (targetDrag)
            {
                CarouselRotator carouselRotator = targetCarousel.GetComponent <CarouselRotator>();
                if (carouselRotator)
                {
                    carouselRotator.OnEndDrag(eventData);
                }
                targetCarousel.SnapToClosest();
                targetDrag = false;

                if ((mainAxisY && (copyAxis == AxisName.vertical)) ||
                    (!mainAxisY && (copyAxis == AxisName.horizontal)))
                {
                    ScrollRect scrollrect = GetComponent <ScrollRect>();
                    if (scrollrect.inertia)
                    {
                        scrollrect.StopMovement();
                    }
                }
            }
        }
Exemplo n.º 3
0
	void Start() {
		rotator = gameObject.GetComponent<AsPerSpec.CarouselRotator> ();
	}
Exemplo n.º 4
0
 void Start()
 {
     rotator = gameObject.GetComponent <AsPerSpec.CarouselRotator> ();
 }