protected override void Start()
        {
            if (handController == null)
            {
        #if CP_ORION
                // handController = CPUtil.FindComponent<LeapHandController>("LeapHandController");
                // leapProvider = CPUtil.FindComponent<LeapProvider>("LeapHandController");
                var leapServiceProvider = CPUtil.FindComponent <LeapServiceProvider>("LeapHandController");
                leapProvider   = (LeapProvider)leapServiceProvider;
                handController = leapServiceProvider.GetLeapController();
        #else
                handController = CPUtil.FindComponent <HandController>("HandController");
        #endif
            }
      #if CP_ORION
            if (leapProvider == null)
            {
                leapProvider = CPUtil.FindComponent <LeapProvider>("LeapHandController");
            }
      #endif
            if (handController == null
                // || !handController.enabled
                )
            {
                Debug.Log("Disabling.");
                enabled = false;
                return;
            }
      #if CP_ORION
            lastProcessedFrame = leapProvider.CurrentFrame;
      #else
            lastProcessedFrame = handController.GetFrame();
      #endif
            base.Start();

#if !CP_ORION
            /* Orion doesn't have gestures yet. */
            if (enableScreenTap)
            {
                handController.GetLeapController().EnableGesture(Gesture.GestureType.TYPE_SCREEN_TAP);

                SetFloat("Gesture.ScreenTap.MinForwardVelocity", screenTapParams.minVelocity);
                SetFloat("Gesture.ScreenTap.HistorySeconds", screenTapParams.historySeconds);
                SetFloat("Gesture.ScreenTap.MinDistance", screenTapParams.minDistance);
            }
            if (enableKeyTap)
            {
                handController.GetLeapController().EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
                SetFloat("Gesture.KeyTap.MinForwardVelocity", keyTapParams.minVelocity);
                SetFloat("Gesture.KeyTap.HistorySeconds", keyTapParams.historySeconds);
                SetFloat("Gesture.KeyTap.MinDistance", keyTapParams.minDistance);
            }
            if (!handController.GetLeapController().Config.Save())
            {
                Debug.Log("Not able to save Leap Motion Controller config settings to service.");
            }
#endif // !CP_ORION
        }
        public void EmptyFallbacks()
        {
            //arrange
            var values = new string[] { null, "", "One" };

            //act
            var actual = CPUtil.EmptyFallback(values);

            //assert
            actual.Should().Be("One");
        }
        public void MakeDictionary_returns_keyvalue_paired(string valuesSeparated)
        {
            //arrange
            string[] values = valuesSeparated.Split(',');

            //act
            var actual = CPUtil.MakeDictionary(values);

            //assert
            actual.ShouldAllBeEquivalentTo(values.Select(val => new KeyValuePair <string, string>(val, val)));
        }
        public void EmptyFallbacks_no_params_returns_null()
        {
            //arrange


            //act
            var actual = CPUtil.EmptyFallback((string[])null);

            //assert
            actual.Should().BeNull();
        }
        public void MakeDictionary_no_args_returns_empty()
        {
            //arrange
            string[] values = null;

            //act
            var actual = CPUtil.MakeDictionary(values);

            //assert
            actual.Should().NotBeNull();
            actual.Should().BeEmpty();
        }
        public void MakeDictionary_duplicate_values_throws()
        {
            //arrange
            string[] values = { "There", "There" };

            //act
            Assert.Throws <ArgumentException>(() =>
            {
                CPUtil.MakeDictionary(values);
            });
            //assert
        }
Beispiel #7
0
 protected void OnEnable()
 {
     if (module == null)
     {
         module = CPUtil.FindComponent <TransformPointerModule>("EventSystem");
         if (module == null)
         {
             Debug.Log("Disabling.");
             enabled = false;
             return;
         }
     }
     pointerId = module.GetNextPointerId(pointerId);
     Register();
 }
Beispiel #8
0
 void Start()
 {
 #if CP_HAVE_LEAPMOTION
     foreach (var go in activateTheseIfLeapMotionDisabled)
     {
         go.SetActive(false);
     }
 #else
     var input = CPUtil.FindComponent <StandaloneInputModule>("EventSystem");
     if (input != null)
     {
         input.enabled = true;
     }
     foreach (var go in activateTheseIfLeapMotionDisabled)
     {
         go.SetActive(true);
     }
 #endif
 }
 IEnumerable <string> Invoke_FilterHashComments(string expected)
 {
     return(CPUtil.FilterHashComments(new string[] { expected }));
 }