Exemplo n.º 1
0
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;

            // If the controllers are not used, we cannot click on a button
            if (!_controllersParameter.UseControllers)
            {
                Debug.Log("VRSF : You won't be able to use the VR Toggle if you're not using the Controllers. To change that,\n" +
                          "Go into the Window/VRSF/VR Interaction Parameters and set the UseControllers bool to true.");
            }

            // We initialize the _EventsDictionary
            _EventsDictionary = new Dictionary <string, GameEventTransform>
            {
                { "Right", _interactionContainer.RightObjectWasClicked },
                { "Left", _interactionContainer.LeftObjectWasClicked },
                { "Gaze", _interactionContainer.GazeObjectWasClicked },
            };

            // We setup the ListenersDictionary
            _ListenersDictionary = _UISetup.CheckGameEventListenersPresence(_GameEventListenersContainer, _ListenersDictionary);
            _ListenersDictionary = _UISetup.SetGameEventListeners(_ListenersDictionary, _EventsDictionary, _gazeParameter.UseGaze);
        }
Exemplo n.º 2
0
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;
            _inputContainer       = InputVariableContainer.Instance;

            _rightIsClicking = _inputContainer.RightClickBoolean.Get("TriggerIsDown");
            _leftIsClicking  = _inputContainer.LeftClickBoolean.Get("TriggerIsDown");

            // If the controllers are not used, we cannot click on the slider, so we will fill the slider with the Over events
            if (!_controllersParameter.UseControllers && FillWithClick)
            {
                FillWithClick = false;
                Debug.Log("VRSF : UseController is set at false. The auto fill slider won't use the controller to fill but the gaze.");
            }

            // We initialize the _EventsDictionary
            InitializeEventsDictionaries();

            // We setup the ListenersDictionary
            _clickListenersDictionary = _uiSetup.CheckGameEventListenersPresence(_gameEventListenersContainer, _clickListenersDictionary, 6);
            _overListenersDictionary  = _uiSetup.CheckGameEventListenersPresence(_gameEventListenersContainer, _overListenersDictionary, 6);

            _clickListenersDictionary = _uiSetup.SetGameEventListeners(_clickListenersDictionary, _clickEventsDictionary, _gazeParameter.UseGaze);
            _overListenersDictionary  = _uiSetup.SetGameEventListeners(_overListenersDictionary, _overEventsDictionary, _gazeParameter.UseGaze);
        }
Exemplo n.º 3
0
        private void Start()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameters       = GazeParametersVariable.Instance;
            _interactionContainer = InteractionVariableContainer.Instance;

            if (!_controllersParameter.UseControllers && !_gazeParameters.UseGaze)
            {
                this.enabled = false;
            }
        }
Exemplo n.º 4
0
        private void Start()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;
            _interactionContainer = InteractionVariableContainer.Instance;

            // We check if the user is at least using the gaze or the controllers
            if (!_controllersParameter.UseControllers && !_gazeParameter.UseGaze)
            {
                this.enabled = false;
            }

            SetupVRComponents();
        }
Exemplo n.º 5
0
        private void Start()
        {
            // Init
            _controllersParameters = ControllersParametersVariable.Instance;
            _gazeParameters        = GazeParametersVariable.Instance;
            _interactionContainer  = InteractionVariableContainer.Instance;

            if (_gazeParameters.UseGaze && _gazeParameters.UseDifferentStates)
            {
                _checkGazeStates = true;
            }

            SetupVRComponents();
        }
Exemplo n.º 6
0
        public virtual void OnEnable()
        {
            // We set the buttonActionChoser reference
            _buttonActionChoser    = (ButtonActionChoser)target;
            _gazeParameters        = GazeParametersVariable.Instance;
            _controllersParameters = ControllersParametersVariable.Instance;

            _onButtonStartTouchingProperty = serializedObject.FindProperty("OnButtonStartTouching");
            _onButtonStopTouchingProperty  = serializedObject.FindProperty("OnButtonStopTouching");
            _onButtonIsTouchingProperty    = serializedObject.FindProperty("OnButtonIsTouching");

            _onButtonStartClickingProperty = serializedObject.FindProperty("OnButtonStartClicking");
            _onButtonStopClickingProperty  = serializedObject.FindProperty("OnButtonStopClicking");
            _onButtonIsClickingProperty    = serializedObject.FindProperty("OnButtonIsClicking");
        }
Exemplo n.º 7
0
        public virtual void Start()
        {
            _controllersParameters = ControllersParametersVariable.Instance;
            _gazeParameters        = GazeParametersVariable.Instance;
            _inputContainer        = InputVariableContainer.Instance;

            // We disable the input script if the controllers are not used
            if (!_controllersParameters.UseControllers)
            {
                this.enabled = false;
            }
            else
            {
                this.enabled = true;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Set the GameEvents and GameEventListeners to null
        /// </summary>
        private void InitSOs()
        {
            _controllersParameters = ControllersParametersVariable.Instance;
            _gazeParameters        = GazeParametersVariable.Instance;
            _inputContainer        = InputVariableContainer.Instance;
            _interactionContainer  = InteractionVariableContainer.Instance;

            _geDown      = null;
            _geUp        = null;
            _geTouched   = null;
            _geUntouched = null;

            _gelDown      = null;
            _gelUp        = null;
            _gelTouched   = null;
            _gelUntouched = null;
        }
Exemplo n.º 9
0
        void Start()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;
            _interactionContainer = InteractionVariableContainer.Instance;

            // Set to true to avoid error on the first frame.
            _interactionContainer.RightHit.isNull = true;
            _interactionContainer.LeftHit.isNull  = true;
            _interactionContainer.GazeHit.isNull  = true;

            // if we don't use the controllers and the gaze
            if (!_controllersParameter.UseControllers && !_gazeParameter.UseGaze)
            {
                this.enabled = false;
            }
        }
Exemplo n.º 10
0
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;
            _inputContainer       = InputVariableContainer.Instance;

            _rightTriggerDown = _inputContainer.RightClickBoolean.Get("TriggerIsDown");
            _leftTriggerDown  = _inputContainer.LeftClickBoolean.Get("TriggerIsDown");

            // If the controllers are not used, we cannot click on a Scroll Bar
            if (!_controllersParameter.UseControllers)
            {
                Debug.Log("VRSF : You won't be able to use the VR ScrollBar if you're not using the Controllers. To change that,\n" +
                          "Go into the Window/VRSF/VR Interaction Parameters and set the UseControllers bool to true.");
            }

            // We initialize the _EventsDictionary
            _EventsDictionary = new Dictionary <string, GameEventTransform>
            {
                { "Right", _interactionContainer.RightObjectWasClicked },
                { "Left", _interactionContainer.LeftObjectWasClicked },
                { "Gaze", _interactionContainer.GazeObjectWasClicked },
            };

            // We initialize the RaycastHitDictionary
            _RaycastHitDictionary = new Dictionary <string, RaycastHitVariable>
            {
                { "Right", _interactionContainer.RightHit },
                { "Left", _interactionContainer.LeftHit },
                { "Gaze", _interactionContainer.GazeHit },
            };
            // We setup the ListenersDictionary
            _ListenersDictionary = _uiSetup.CheckGameEventListenersPresence(_GameEventListenersContainer, _ListenersDictionary);
            _ListenersDictionary = _uiSetup.SetGameEventListeners(_ListenersDictionary, _EventsDictionary, _gazeParameter.UseGaze);


            // Check if the Min and Max object are already created, and set there references
            _ScrollableSetup.CheckMinMaxGameObjects(handleRect.parent, UnityUIToVRSFUI.ScrollbarDirectionToUIDirection(direction));
            _ScrollableSetup.SetMinMaxPos(ref _MinPosBar, ref _MaxPosBar, handleRect.parent);

            value = 1;
        }
Exemplo n.º 11
0
        void Start()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;
            _inputContainer       = InputVariableContainer.Instance;
            _interactionContainer = InteractionVariableContainer.Instance;

            _leftClick  = _inputContainer.LeftClickBoolean.Get("TriggerIsDown");
            _rightClick = _inputContainer.RightClickBoolean.Get("TriggerIsDown");

            // Set to true to avoid error on the first frame.
            _interactionContainer.RightHit.isNull = true;
            _interactionContainer.LeftHit.isNull  = true;
            _interactionContainer.GazeHit.isNull  = true;

            // As we cannot click without controllers, we disable this script if we don't use them
            if (!_controllersParameter.UseControllers)
            {
                this.enabled = false;
            }
        }
Exemplo n.º 12
0
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;
            _inputContainer       = InputVariableContainer.Instance;

            _rightIsClicking = _inputContainer.RightClickBoolean.Get("TriggerIsDown");
            _leftIsClicking  = _inputContainer.LeftClickBoolean.Get("TriggerIsDown");

            // If the controllers are not used, we cannot click on the slider, so we will fill the slider with the Over events
            if (!_controllersParameter.UseControllers)
            {
                Debug.Log("VRSF : You won't be able to use the VR Handle Slider if you're not using the Controllers. To change that,\n" +
                          "Go into the Window/VRSF/VR Interaction Parameters and set the UseControllers bool to true.");
            }

            _EventsDictionary = new Dictionary <string, GameEventTransform>
            {
                { "Right", _interactionContainer.RightObjectWasClicked },
                { "Left", _interactionContainer.LeftObjectWasClicked },
                { "Gaze", _interactionContainer.GazeObjectWasClicked },
            };

            _RaycastHitDictionary = new Dictionary <string, RaycastHitVariable>
            {
                { "Right", _interactionContainer.RightHit },
                { "Left", _interactionContainer.LeftHit },
                { "Gaze", _interactionContainer.GazeHit },
            };

            ScrollableSetup.CheckMinMaxGameObjects(handleRect.parent, UnityUIToVRSFUI.SliderDirectionToUIDirection(direction));

            _ListenersDictionary = _uiSetup.CheckGameEventListenersPresence(gameEventListenersContainer, _ListenersDictionary);

            _ListenersDictionary = _uiSetup.SetGameEventListeners(_ListenersDictionary, _EventsDictionary, _gazeParameter.UseGaze);

            ScrollableSetup.SetMinMaxPos(ref _MinPosBar, ref _MaxPosBar, handleRect.parent);
        }
Exemplo n.º 13
0
        // EMPTY
        #region PUBLIC_METHODS
        #endregion PUBLIC_METHODS


        #region PRIVATE_METHODS
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;

            // If the controllers are not used, we cannot click on a Dropdown
            if (!_controllersParameter.UseControllers)
            {
                Debug.Log("VRSF : You won't be able to use the VR DropDown if you're not using the Controllers. To change that,\n" +
                          "Go into the Window/VRSF/VR Interaction Parameters and set the UseControllers bool to true.");
            }

            onValueChanged.AddListener(delegate { SetDropDownNewState(); });

            // We initialize the _EventsDictionary
            _EventsDictionary = new Dictionary <string, GameEventTransform>
            {
                { "Right", _interactionContainer.RightObjectWasClicked },
                { "Left", _interactionContainer.LeftObjectWasClicked },
                { "Gaze", _interactionContainer.GazeObjectWasClicked },
            };

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

            // We setup the ListenersDictionary
            _ListenersDictionary = _UISetup.CheckGameEventListenersPresence(_GameEventListenersContainer, _ListenersDictionary);
            _ListenersDictionary = _UISetup.SetGameEventListeners(_ListenersDictionary, _EventsDictionary, _gazeParameter.UseGaze);

            // We setup the Template and Options to fit the VRFramework
            _Template = transform.Find("Template").gameObject;
            SetToggleReferences();
            ChangeTemplate();
        }
Exemplo n.º 14
0
 /// <summary>
 /// Used to get the Parameters Variable Instance
 /// </summary>
 private void OnEnable()
 {
     _gazeParameters        = GazeParametersVariable.Instance;
     _controllersParameters = ControllersParametersVariable.Instance;
 }