Example #1
0
 /// <summary>
 /// Handler for Tap gesture.
 /// </summary>
 /// <param name="controllerId">Controller ID</param>
 /// <param name="touchpadGesture">Touchpad Gesture</param>
 private void HandleTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture touchpadGesture)
 {
     if (_controllerHandler.IsControllerValid() &&
         _controllerHandler.ConnectedController.Id == controllerId &&
         touchpadGesture.Type == MLInput.Controller.TouchpadGesture.GestureType.Tap &&
         _prevButton != null)
     {
         _prevButton.Tap();
     }
 }
Example #2
0
 /// <summary>
 /// Handles the event for touchpad gesture start. Changes level of detail
 /// if gesture is swipe up.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="gesture">The gesture getting started.</param>
 private void OnTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture gesture)
 {
     #if PLATFORM_LUMIN
     if (_controllerConnectionHandler.IsControllerValid(controllerId) &&
         gesture.Type == MLInput.Controller.TouchpadGesture.GestureType.Swipe && gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Up)
     {
         _meshingBehavior.LevelOfDetail = ((_meshingBehavior.LevelOfDetail == MLMeshing.LOD.Maximum) ? MLMeshing.LOD.Minimum : (_meshingBehavior.LevelOfDetail + 1));
     }
     #endif
 }
Example #3
0
 /// <summary>
 /// Handles the event for touchpad gesture start. Changes level of detail
 /// if gesture is swipe up.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="gesture">The gesture getting started.</param>
 private void OnTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture gesture)
 {
     #if PLATFORM_LUMIN
     if (_controllerConnectionHandler.IsControllerValid(controllerId) &&
         gesture.Type == MLInput.Controller.TouchpadGesture.GestureType.Swipe && gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Up)
     {
         #if UNITY_2019_3_OR_NEWER
         _mlSpatialMapper.density = MLSpatialMapper.LevelOfDetailToDensity((MLSpatialMapper.DensityToLevelOfDetail(_mlSpatialMapper.density) == MLSpatialMapper.LevelOfDetail.Maximum) ? MLSpatialMapper.LevelOfDetail.Minimum : (MLSpatialMapper.DensityToLevelOfDetail(_mlSpatialMapper.density) + 1));
         #else
         _mlSpatialMapper.levelOfDetail = ((_mlSpatialMapper.levelOfDetail == MLSpatialMapper.LevelOfDetail.Maximum) ? MLSpatialMapper.LevelOfDetail.Minimum : (_mlSpatialMapper.levelOfDetail + 1));
         #endif
     }
     #endif
 }
        /// <summary>
        /// Handler when touchpad gesture begins.
        /// </summary>
        /// <param name="controllerId">Id of the incoming controller.</param>
        /// <param name="touchpadGesture">Class of which gesture was started.</param>
        private void HandleTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture touchpadGesture)
        {
            if (!_controller.IsControllerValid(controllerId))
            {
                return;
            }

#if PLATFORM_LUMIN
            if (touchpadGesture.Type == MLInput.Controller.TouchpadGesture.GestureType.RadialScroll)
            {
                _deleteAllInitiated          = true;
                _deleteAllSequenceFrameCount = 0;
            }
#endif
        }
        /// <summary>
        /// Handler when touchpad gesture ends.
        /// </summary>
        /// <param name="controllerId">Id of the incoming controller.</param>
        /// <param name="touchpadGesture">Class of which gesture was ended.</param>
        private void HandleTouchpadGestureEnd(byte controllerId, MLInput.Controller.TouchpadGesture touchpadGesture)
        {
            if (!_controller.IsControllerValid(controllerId))
            {
                return;
            }

            if (_deleteAllInitiated)
            {
#if PLATFORM_LUMIN
                if (touchpadGesture.Type == MLInput.Controller.TouchpadGesture.GestureType.RadialScroll &&
                    _deleteAllSequenceFrameCount < _deleteAllSequenceMinFrames)
                {
                    _deleteAllInitiated = false;
                }
#endif
            }
        }
Example #6
0
 /// <summary>
 /// Handles the event for touchpad gesture start.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="gesture">The type of gesture that started.</param>
 private void HandleOnTouchpadGestureStart(byte controllerId, MLInput.Controller.TouchpadGesture gesture)
 {
     #if PLATFORM_LUMIN
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && gesture.Type == MLInput.Controller.TouchpadGesture.GestureType.Swipe)
     {
         // Increase / Decrease the marker distance based on the swipe gesture.
         if (gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Up || gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Down)
         {
             if (_marks.Length > 0)
             {
                 _currentMarkIndex = (gesture.Direction == MLInput.Controller.TouchpadGesture.GestureDirection.Up) ?
                                     Mathf.Min(_currentMarkIndex + 1, _marks.Length - 1) :
                                     Mathf.Max(_currentMarkIndex - 1, 0);
                 _positionMarker.localPosition = new Vector3(0, POSITION_MARKER_Y_OFFSET, _marks[_currentMarkIndex]);
             }
         }
     }
     #endif
 }
        /// <summary>
        /// Handler when touchpad gesture continues.
        /// </summary>
        /// <param name="controllerId">Id of the incoming controller.</param>
        /// <param name="touchpadGesture">Class of which gesture was continued.</param>
        private void HandleTouchpadGestureContinue(byte controllerId, MLInput.Controller.TouchpadGesture touchpadGesture)
        {
            if (!_controller.IsControllerValid(controllerId))
            {
                return;
            }

            if (_deleteAllInitiated)
            {
#if PLATFORM_LUMIN
                if (touchpadGesture.Type == MLInput.Controller.TouchpadGesture.GestureType.RadialScroll)
                {
                    ++_deleteAllSequenceFrameCount;
                    if (_deleteAllSequenceFrameCount >= _deleteAllSequenceMinFrames)
                    {
                        _deleteAllInitiated = false;

                        foreach (KeyValuePair <PersistentBall, string> persistentContentPair in _persistentContentMap)
                        {
                            PersistentBall persistentContent = persistentContentPair.Key;

                            string val = _persistentContentMap[persistentContent];

                            if (val == "Created")
                            {
                                --numPersistentContentCreated;
                            }
                            else if (val == "Regained")
                            {
                                --numPersistentContentRegained;
                            }

                            persistentContent.DestroyContent(persistentContent.gameObject);
                        }

                        _persistentContentMap.Clear();
                    }
                }
#endif
            }
        }