コード例 #1
0
        private void SetupVRScrollRect()
        {
            _scrollableSetup = new VRUIScrollableSetup(Direction);

            // We setup the references to the ScrollRect elements
            SetScrollRectReferences();

            // We override the directio selected in the inspector by the scrollbar direction if we use one
            // The vertical direction will always have top priority on the horizontal direction
            if (vertical && verticalScrollbar != null)
            {
                Direction = UnityUIToVRDFUI.ScrollbarDirectionToUIDirection(verticalScrollbar.direction);
                verticalScrollbar.onValueChanged.AddListener(delegate { OnValueChangedCallback(); });
            }
            else if (horizontal && horizontalScrollbar != null)
            {
                Direction = UnityUIToVRDFUI.ScrollbarDirectionToUIDirection(horizontalScrollbar.direction);
                horizontalScrollbar.onValueChanged.AddListener(delegate { OnValueChangedCallback(); });
            }

            OnVRClickerStartClicking.Listeners += CheckClickedObject;
            OnVRClickerStopClicking.Listeners  += CheckUnclickedObject;

            // We setup the Min and Max pos transform
            _scrollableSetup.CheckMinMaxGameObjects(transform, Direction, ref _minPosBar, ref _maxPosBar);
            _scrollableSetup.CheckContentStatus(viewport, content);
        }
コード例 #2
0
 private void OnValueChangedCallback()
 {
     _scrollableSetup.CheckContentStatus(viewport, content);
 }