Beispiel #1
0
        protected override void FinishSetup()
        {
            base.FinishSetup();

            trackingState  = GetChildControl <IntegerControl>("trackingState");
            isTracked      = GetChildControl <ButtonControl>("isTracked");
            devicePosition = GetChildControl <Vector3Control>("devicePosition");
            deviceRotation = GetChildControl <QuaternionControl>("deviceRotation");

            touchpad1Pressed  = GetChildControl <ButtonControl>("touchpad1Pressed");
            touchpad1Position = GetChildControl <Vector2Control>("touchpad1Position");
            touchpad1Force    = GetChildControl <AxisControl>("touchpad1Force");

            touchpad2Pressed  = GetChildControl <ButtonControl>("touchpad2Pressed");
            touchpad2Position = GetChildControl <Vector2Control>("touchpad2Position");
            touchpad2Force    = GetChildControl <AxisControl>("touchpad2Force");

            triggerButton = GetChildControl <ButtonControl>("triggerButton");
            trigger       = GetChildControl <AxisControl>("trigger");
            bumper        = GetChildControl <ButtonControl>("bumper");
            menu          = GetChildControl <ButtonControl>("menu");

            dof = GetChildControl <IntegerControl>("dof");
            calibrationAccuracy = GetChildControl <IntegerControl>("calibrationAccuracy");
            type = GetChildControl <IntegerControl>("type");
        }
        private void determinePVarControls(RatchetMoby moby)
        {
            mobyPVarGroup.Controls.Clear();
            int yOffset = 15;
            int xOffset = 5;

            if (moby.pVarConfig != null)
            {
                foreach (MobyPVar pVar in moby.pVarConfig)
                {
                    switch (pVar.control)
                    {
                    case "float":
                        FloatControl floatControl = new FloatControl(moby.pVars, pVar);
                        floatControl.Location        = new Point(xOffset, yOffset);
                        floatControl.OnValueChanged += (s, e) => handleChange(pVar, e);
                        mobyPVarGroup.Controls.Add(floatControl);
                        yOffset += floatControl.Height;
                        break;

                    case "number":
                        IntegerControl intControl = new IntegerControl(moby.pVars, pVar);
                        intControl.Location        = new Point(xOffset, yOffset);
                        intControl.OnValueChanged += (s, e) => handleChange(pVar, e);
                        mobyPVarGroup.Controls.Add(intControl);
                        yOffset += intControl.Height;
                        break;
                    }
                }
                ;
            }
        }
    private void UpdateInteger(InputAction.CallbackContext context)
    {
        IntegerControl control = context.control as IntegerControl;

        if (control != null)
        {
            int value = control.ReadValue();
            statusText.text = value.ToString();
        }
    }
        protected override void FinishSetup()
        {
            base.FinishSetup();

            confidence = GetChildControl <AxisControl>("confidence");
            fixationPointConfidence  = GetChildControl <AxisControl>("fixationPointConfidence");
            eyeLeftCenterConfidence  = GetChildControl <AxisControl>("eyeLeftCenterConfidence");
            eyeRightCenterConfidence = GetChildControl <AxisControl>("eyeRightCenterConfidence");
            eyes = GetChildControl <EyesControl>("eyes");
            eyeCalibrationStatus = GetChildControl <IntegerControl>("eyeCalibrationStatus");

            EyesEnabled = true;
        }
Beispiel #5
0
        protected override void FinishSetup()
        {
            base.FinishSetup();

            trackingState            = GetChildControl <IntegerControl>("trackingState");
            isTracked                = GetChildControl <ButtonControl>("isTracked");
            devicePosition           = GetChildControl <Vector3Control>("devicePosition");
            deviceRotation           = GetChildControl <QuaternionControl>("deviceRotation");
            centerEyePosition        = GetChildControl <Vector3Control>("centerEyePosition");
            centerEyeRotation        = GetChildControl <QuaternionControl>("centerEyeRotation");
            confidence               = GetChildControl <AxisControl>("confidence");
            fixationPointConfidence  = GetChildControl <AxisControl>("fixationPointConfidence");
            eyeLeftCenterConfidence  = GetChildControl <AxisControl>("eyeLeftCenterConfidence");
            eyeRightCenterConfidence = GetChildControl <AxisControl>("eyeRightCenterConfidence");
            eyes = GetChildControl <EyesControl>("eyes");
            eyeCalibrationStatus = GetChildControl <IntegerControl>("eyeCalibrationStatus");

            EyesEnabled = true;
        }
    void OnEnable()
    {
        IntegerAction.performed += UpdateInteger;
        IntegerAction.started   += UpdateInteger;
        IntegerAction.cancelled += UpdateInteger;
        IntegerAction.Enable();

        ReadOnlyArray <InputControl> controls = IntegerAction.controls;

        for (int i = 0; i < controls.Count; i++)
        {
            IntegerControl control = controls[i] as IntegerControl;
            if (control != null)
            {
                int value = control.ReadValue();
                statusText.text = value.ToString();
            }
            else
            {
                Debug.LogWarningFormat(this, "IntegerControlActionStatus expects bindings of type {1}, but found {1} binding named {2}.", typeof(IntegerControl).FullName, controls[i].GetType().FullName, controls[i].name);
            }
        }
    }
Beispiel #7
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     stepCounter = builder.GetControl <IntegerControl>("stepCounter");
     base.FinishSetup(builder);
 }