예제 #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();
        }
예제 #2
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.");
            }
        }
예제 #3
0
파일: VRToggle.cs 프로젝트: VRUN-Game/VRUN
        // 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());
            }
        }
예제 #4
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();
        }
예제 #5
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);
            }
        }