Exemplo n.º 1
0
        // EMPTY
        #region PUBLIC_METHODS
        #endregion


        #region PRIVATE_METHODS
        private void MakeBasicSetup()
        {
            // We initialize the _ListenersDictionary
            _ListenersDictionary = new Dictionary <string, GameEventListenerTransform>
            {
                { "Right", null },
                { "Left", null },
                { "Gaze", null },
            };

            // We create new object to setup the button references; listeners and GameEventListeners
            _CheckObject     = CheckBarClick;
            _uiSetup         = new VRUISetup(_CheckObject);
            _ClickOnlySetup  = new VRScrollbarSetup();
            _ScrollableSetup = new VRUIScrollableSetup(UnityUIToVRSFUI.ScrollbarDirectionToUIDirection(direction));

            // Check if the Listeners GameObject is set correctly. If not, create the child
            if (!_ClickOnlySetup.CheckGameEventListenerChild(ref _GameEventListenersContainer, ref _ListenersDictionary, transform))
            {
                _uiSetup.CreateGameEventListenerChild(ref _GameEventListenersContainer, transform);
            }

            if (!_boxColliderSetup && gameObject.activeInHierarchy)
            {
                StartCoroutine(SetupBoxCollider());
            }

            GetHandleRectReference();
        }
Exemplo n.º 2
0
        // EMPTY
        #region PUBLIC_METHODS
        #endregion PUBLIC_METHODS


        #region PRIVATE_METHODS
        private void MakeBasicSetup()
        {
            // We initialize the _ListenersDictionary
            _ListenersDictionary = new Dictionary <string, GameEventListenerTransform>
            {
                { "Right", null },
                { "Left", null },
                { "Gaze", null },
            };

            // We create new object to setup the button references; listeners and GameEventListeners
            _CheckObject    = CheckToggleClick;
            _UISetup        = new VRUISetup(_CheckObject);
            _ClickOnlySetup = new VRToggleSetup();

            // Check if the Listeners GameObject is set correctly. If not, create the child
            if (!_ClickOnlySetup.CheckGameEventListenerChild(ref _GameEventListenersContainer, ref _ListenersDictionary, transform))
            {
                _UISetup.CreateGameEventListenerChild(ref _GameEventListenersContainer, transform);
            }

            if (!_boxColliderSetup && gameObject.activeInHierarchy)
            {
                // We setup the BoxCollider size and center
                StartCoroutine(SetupBoxCollider());
            }
        }
Exemplo n.º 3
0
        // EMPTY
        #region PUBLIC_METHODS
        #endregion


        #region PRIVATE_METHODS
        private void MakeBasicSetup()
        {
            _ListenersDictionary = new Dictionary <string, GameEventListenerTransform>
            {
                { "Right", null },
                { "Left", null },
                { "Gaze", null },
            };

            CheckObject     = CheckSliderClick;
            _uiSetup        = new VRUISetup(CheckObject);
            ClickOnlySetup  = new VRHandleSliderSetup();
            ScrollableSetup = new VRUIScrollableSetup(UnityUIToVRSFUI.SliderDirectionToUIDirection(direction), minValue, maxValue, wholeNumbers);

            // Check if the Listeners GameObject is set correctly. If not, create the child
            if (!ClickOnlySetup.CheckGameEventListenerChild(ref gameEventListenersContainer, ref _ListenersDictionary, transform))
            {
                _uiSetup.CreateGameEventListenerChild(ref gameEventListenersContainer, transform);
            }

            if (!_boxColliderSetup && gameObject.activeInHierarchy)
            {
                StartCoroutine(SetupBoxCollider());
            }

            try
            {
                handleRect = transform.FindDeepChild("Handle").GetComponent <RectTransform>();
                fillRect   = transform.FindDeepChild("Fill").GetComponent <RectTransform>();
            }
            catch
            {
                Debug.LogError("Please add a Handle and a Fill with RectTransform as children of this VR Handle Slider.");
            }
        }
Exemplo n.º 4
0
        private void MakeBasicSetup()
        {
            // We initialize the Listeners Dictionaries
            InitializeListenerDictionaries();

            // We create new object to setup the button references; listeners and GameEventListeners, and add the delegate method to it
            _checkObjectClicked = CheckSliderClick;
            _checkObjectOver    = CheckSliderHovered;

            _uiSetup           = new VRUISetup(_checkObjectClicked, _checkObjectOver);
            _clickAndOverSetup = new VRAutoFillSliderSetup();

            // Check if the Listeners GameObject are set correctly. If not, create the children
            bool clickListernersPresent = _clickAndOverSetup.CheckGameEventListenerChild(ref _gameEventListenersContainer, ref _clickListenersDictionary, transform, EUIInputType.CLICK);
            bool overListernersPresent  = _clickAndOverSetup.CheckGameEventListenerChild(ref _gameEventListenersContainer, ref _overListenersDictionary, transform, EUIInputType.OVER);

            if (!clickListernersPresent && !overListernersPresent)
            {
                _uiSetup.CreateGameEventListenerChild(ref _gameEventListenersContainer, transform);
            }

            if (Application.isPlaying && gameObject.activeInHierarchy)
            {
                // We setup the BoxCollider size and center
                StartCoroutine(SetupBoxCollider());
            }

            GetFillRectReference();
        }
Exemplo n.º 5
0
        // EMPTY
        #region PUBLIC_METHODS
        #endregion


        #region PRIVATE_METHODS
        private void MakeBasicSetup()
        {
            // We initialize the _ListenersDictionary
            _ListenersDictionary = new Dictionary <string, GameEventListenerTransform>
            {
                { "Right", null },
                { "Left", null },
                { "Gaze", null },
            };

            // 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.gameObject != null)
            {
                Direction = UnityUIToVRSFUI.ScrollbarDirectionToUIDirection(verticalScrollbar.direction);
            }
            else if (horizontal && horizontalScrollbar.gameObject != null)
            {
                Direction = UnityUIToVRSFUI.ScrollbarDirectionToUIDirection(horizontalScrollbar.direction);
            }

            // We create new object to setup the button references; listeners and GameEventListeners
            _CheckObject     = CheckRectClick;
            _UISetup         = new VRUISetup(_CheckObject);
            _ClickOnlySetup  = new VRScrollbarSetup();
            _ScrollableSetup = new VRUIScrollableSetup(Direction);

            // Check if the Listeners GameObject is set correctly. If not, create the child
            if (!_ClickOnlySetup.CheckGameEventListenerChild(ref _GameEventListenersContainer, ref _ListenersDictionary, transform))
            {
                _UISetup.CreateGameEventListenerChild(ref _GameEventListenersContainer, transform);
            }

            if (!_boxColliderSetup && gameObject.activeInHierarchy)
            {
                // We setup the BoxCollider size and center
                StartCoroutine(SetupBoxCollider());
            }

            // We setup the references to the ScrollRect elements
            SetScrollRectReferences();
        }
Exemplo n.º 6
0
        protected override void OnValidate()
        {
            base.OnValidate();

            // We initialize the _ListenersDictionary
            _ListenersDictionary = new Dictionary <string, GameEventListenerTransform>
            {
                { "Right", null },
                { "Left", null },
                { "Gaze", null },
            };

            // We create new object to setup the button references; listeners and GameEventListeners
            _CheckObject    = CheckObjectClicked;
            _UISetup        = new VRUISetup(_CheckObject);
            _ClickOnlySetup = new VRDropdownSetup();

            // Check if the Listeners GameObject is set correctly. If not, create the child
            if (!_ClickOnlySetup.CheckGameEventListenerChild(ref _GameEventListenersContainer, ref _ListenersDictionary, transform))
            {
                _UISetup.CreateGameEventListenerChild(ref _GameEventListenersContainer, transform);
            }
        }