protected override void ValidateValues()
    {
        var dotSize = Mathf.Clamp(cursorDotSizeSlider.value, ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorDotSize_Min), ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorDotSize_Max));

        cursorDotSizeSlider.SetValueWithoutNotify(dotSize);
        cursorDotSize.SetTextWithoutNotify(dotSize.ToString("#0.00#"));

        var ringScale = Mathf.Clamp(cursorMaxRingScaleSlider.value, SettingsConfig.CursorRingMaxScale_Min, SettingsConfig.CursorRingMaxScale_Max);

        cursorMaxRingScaleSlider.SetValueWithoutNotify(ringScale);
        cursorMaxRingScale.SetTextWithoutNotify(ringScale.ToString("#0.00#"));

        var maxDistance = Mathf.Clamp(cursorMaxRingScaleAtDistanceSlider.value, ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorMaxRingScaleAtDistance_Min), ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorMaxRingScaleAtDistance_Max));

        cursorMaxRingScaleAtDistanceSlider.SetValueWithoutNotify(maxDistance);
        cursorMaxRingScaleAtDistance.SetTextWithoutNotify(maxDistance.ToString("#0.00#"));

        var deadzoneRadius = Mathf.Clamp(cursorDeadzoneSlider.value, SettingsConfig.CursorDeadzone_Min, SettingsConfig.CursorDeadzone_Max);

        cursorDeadzoneSlider.SetValueWithoutNotify(deadzoneRadius);

        var verticalOffset = Mathf.Clamp(cursorVerticalOffsetSlider.value, ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorVerticalOffset_Min), ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorVerticalOffset_Max));

        cursorVerticalOffsetSlider.SetValueWithoutNotify(verticalOffset);
        cursorVerticalOffset.SetTextWithoutNotify(verticalOffset.ToString("#0.00#"));

        var hoverStartTime = Mathf.Clamp(HoverCursorStartTimeSlider.value, SettingsConfig.HoverCursorStartTime_Min, SettingsConfig.HoverCursorStartTime_Max);

        HoverCursorStartTime.SetTextWithoutNotify(hoverStartTime.ToString("#0.00#"));
        HoverCursorStartTimeSlider.SetValueWithoutNotify(hoverStartTime);

        var hoverCompleteTime = Mathf.Clamp(HoverCursorCompleteTimeSlider.value, SettingsConfig.HoverCursorCompleteTime_Min, SettingsConfig.HoverCursorCompleteTime_Max);

        HoverCursorCompleteTime.SetTextWithoutNotify(hoverCompleteTime.ToString("#0.00#"));
        HoverCursorCompleteTimeSlider.SetValueWithoutNotify(hoverCompleteTime);

        CTIShowTimer.SetTextWithoutNotify(TryParseNewStringToFloat(ref CallToInteractConfig.Config.ShowTimeAfterNoHandPresent, CTIShowTimer.text).ToString("#0.00#"));
        CTIHideTimer.SetTextWithoutNotify(TryParseNewStringToFloat(ref CallToInteractConfig.Config.HideTimeAfterHandPresent, CTIHideTimer.text).ToString("#0.00#"));

        switch (CallToInteractConfig.Config.hideType)
        {
        case HideRequirement.PRESENT:
            activityHideOption.SetActive(true);
            break;

        case HideRequirement.INTERACTION:
            activityHideOption.SetActive(false);
            break;
        }

        ValidateInteractionTypeElements();
        hoverEventsWarning.SetActive(sendHoverEventsTog.isOn);
    }
Ejemplo n.º 2
0
    void InitialiseUI()
    {
        PhysicalScreenTiltAngleSlider.minValue = PhysicalConfigurable.ScreenTilt_Min;
        ScreenHeightSlider.minValue            = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.ScreenHeight_Min);
        TrackingOriginXSlider.minValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginX_Min);
        TrackingOriginYSlider.minValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginY_Min);
        TrackingOriginZSlider.minValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginZ_Min);
        TrackingRotationXSlider.minValue       = PhysicalConfigurable.TrackingRoation_Min;

        PhysicalScreenTiltAngleSlider.maxValue = PhysicalConfigurable.ScreenTilt_Max;
        ScreenHeightSlider.maxValue            = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.ScreenHeight_Max);
        TrackingOriginXSlider.maxValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginX_Max);
        TrackingOriginYSlider.maxValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginY_Max);
        TrackingOriginZSlider.maxValue         = ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.TrackingOriginZ_Max);
        TrackingRotationXSlider.maxValue       = PhysicalConfigurable.TrackingRoation_Max;
    }
Ejemplo n.º 3
0
    protected override void LoadConfigValuesIntoFields()
    {
        PhysicalScreenTiltAngle.SetTextWithoutNotify(PhysicalConfigurable.Config.ScreenRotationD.ToString("##0.0"));
        ScreenHeight.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.ScreenHeightM).ToString("#0.00#"));
        TrackingOriginX.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.x).ToString("#0.00#"));
        TrackingOriginY.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.y).ToString("#0.00#"));
        TrackingOriginZ.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(-PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.z).ToString("#0.00#"));
        TrackingRotationX.SetTextWithoutNotify(PhysicalConfigurable.Config.LeapRotationD.x.ToString("##0.0"));

        var bottomMount = Mathf.Approximately(PhysicalConfigurable.Config.LeapRotationD.z, 0f);

        PhysicalScreenTiltAngleSlider.SetValueWithoutNotify(PhysicalConfigurable.Config.ScreenRotationD);
        ScreenHeightSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.ScreenHeightM));
        TrackingOriginXSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.x));
        TrackingOriginYSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.y));
        TrackingOriginZSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(-PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM.z));
        TrackingRotationXSlider.SetValueWithoutNotify(PhysicalConfigurable.Config.LeapRotationD.x);
    }
    void InitialiseUI()
    {
        cursorDotSizeSlider.minValue                = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorDotSize_Min);
        cursorDotSizeSlider.maxValue                = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorDotSize_Max);
        cursorMaxRingScaleSlider.minValue           = SettingsConfig.CursorRingMaxScale_Min;
        cursorMaxRingScaleSlider.maxValue           = SettingsConfig.CursorRingMaxScale_Max;
        cursorMaxRingScaleAtDistanceSlider.minValue = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorMaxRingScaleAtDistance_Min);
        cursorMaxRingScaleAtDistanceSlider.maxValue = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorMaxRingScaleAtDistance_Max);

        cursorDeadzoneSlider.minValue = SettingsConfig.CursorDeadzone_Min;
        cursorDeadzoneSlider.maxValue = SettingsConfig.CursorDeadzone_Max;

        cursorVerticalOffsetSlider.minValue = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorVerticalOffset_Min);
        cursorVerticalOffsetSlider.maxValue = ScreenControlUtility.ToDisplayUnits(SettingsConfig.CursorVerticalOffset_Max);

        HoverCursorStartTimeSlider.minValue    = SettingsConfig.HoverCursorStartTime_Min;
        HoverCursorStartTimeSlider.maxValue    = SettingsConfig.HoverCursorStartTime_Max;
        HoverCursorCompleteTimeSlider.minValue = SettingsConfig.HoverCursorCompleteTime_Min;
        HoverCursorCompleteTimeSlider.maxValue = SettingsConfig.HoverCursorCompleteTime_Max;

        customCursorDotFillColour    = SettingsConfig.Config.CursorDotFillColor;
        customCursorDotBorderColour  = SettingsConfig.Config.CursorDotBorderColor;
        customCursorRingColour       = SettingsConfig.Config.CursorRingColor;
        customCursorDotFillOpacity   = SettingsConfig.Config.CursorDotFillOpacity;
        customCursorDotBorderOpacity = SettingsConfig.Config.CursorDotBorderOpacity;
        customCursorRingOpacity      = SettingsConfig.Config.CursorRingOpacity;

        if (SettingsConfig.Config.CursorColorPreset == CursorColourPreset.custom)
        {
            // we are in custom, so only worry about custom colours
            foreach (var label in customCursorColourLabels)
            {
                label.SetActive(true);
            }
        }
        else
        {
            foreach (var label in customCursorColourLabels)
            {
                label.SetActive(false);
            }
        }
    }
Ejemplo n.º 5
0
    protected float TryParseNewStringToFloat(ref float _original, string _newText, bool _convertToStorageUnits = false, bool _convertToDisplayUnits = false)
    {
        // Match any character that is not period (.), hypen (-), or numbers 0 to 9, and strip them out.
        _newText = Regex.Replace(_newText, "[^.0-9-]", "");

        float val;

        if (!float.TryParse(_newText, NumberStyles.Number, CultureInfo.CurrentCulture, out val))
        {
            val = _original; // string was not compatible!
        }
        if (_convertToDisplayUnits)
        {
            val = ScreenControlUtility.ToDisplayUnits(val);
        }
        else if (_convertToStorageUnits)
        {
            val = ScreenControlUtility.FromDisplayUnits(val);
        }

        return(val);
    }
    protected override void LoadConfigValuesIntoFields()
    {
        resolutionWidth.text  = Screen.currentResolution.width.ToString();
        resolutionHeight.text = Screen.currentResolution.height.ToString();

        cursorDotSize.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorDotSizeM).ToString("#0.00#"));
        cursorDotSizeSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorDotSizeM));
        cursorMaxRingScale.SetTextWithoutNotify(SettingsConfig.Config.CursorRingMaxScale.ToString("#0.00#"));
        cursorMaxRingScaleSlider.SetValueWithoutNotify(SettingsConfig.Config.CursorRingMaxScale);
        cursorMaxRingScaleAtDistance.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorMaxRingScaleAtDistanceM).ToString("#0.00#"));
        cursorMaxRingScaleAtDistanceSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorMaxRingScaleAtDistanceM));
        scrollingOrDraggingTog.SetIsOnWithoutNotify(SettingsConfig.Config.UseScrollingOrDragging);
        setupOnStartup.SetIsOnWithoutNotify(SettingsConfig.Config.ShowSetupScreenOnStartup);
        sendHoverEventsTog.SetIsOnWithoutNotify(SettingsConfig.Config.SendHoverEvents);

        cursorRingColor.SetTextWithoutNotify(SettingsConfig.Config.CursorRingColor);
        cursorRingOpacity.SetValueWithoutNotify(SettingsConfig.Config.CursorRingOpacity);
        cursorDotFillColor.SetTextWithoutNotify(SettingsConfig.Config.CursorDotFillColor);
        cursorDotFillOpacity.SetValueWithoutNotify(SettingsConfig.Config.CursorDotFillOpacity);
        cursorDotBorderColor.SetTextWithoutNotify(SettingsConfig.Config.CursorDotBorderColor);
        cursorDotBorderOpacity.SetValueWithoutNotify(SettingsConfig.Config.CursorDotBorderOpacity);

        cursorDeadzoneSlider.SetValueWithoutNotify(SettingsConfig.Config.DeadzoneRadius);
        cursorVerticalOffset.SetTextWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorVerticalOffset).ToString("#0.00#"));
        cursorVerticalOffsetSlider.SetValueWithoutNotify(ScreenControlUtility.ToDisplayUnits(SettingsConfig.Config.CursorVerticalOffset));

        HoverCursorStartTime.SetTextWithoutNotify(SettingsConfig.Config.HoverCursorStartTimeS.ToString("#0.00#"));
        HoverCursorStartTimeSlider.SetValueWithoutNotify(SettingsConfig.Config.HoverCursorStartTimeS);
        HoverCursorCompleteTime.SetTextWithoutNotify(SettingsConfig.Config.HoverCursorCompleteTimeS.ToString("#0.00#"));
        HoverCursorCompleteTimeSlider.SetValueWithoutNotify(SettingsConfig.Config.HoverCursorCompleteTimeS);

        interactionTypeTogglePush.SetIsOnWithoutNotify(false);
        interactionTypeTogglePoke.SetIsOnWithoutNotify(false);
        interactionTypeTogglePinch.SetIsOnWithoutNotify(false);
        interactionTypeToggleHover.SetIsOnWithoutNotify(false);
        switch (SettingsConfig.Config.InteractionSelection)
        {
        case InteractionSelection.Push:
            interactionTypeTogglePush.SetIsOnWithoutNotify(true);
            break;

        case InteractionSelection.Poke:
            interactionTypeTogglePoke.SetIsOnWithoutNotify(true);
            break;

        case InteractionSelection.Grab:
            interactionTypeTogglePinch.SetIsOnWithoutNotify(true);
            break;

        case InteractionSelection.Hover:
            interactionTypeToggleHover.SetIsOnWithoutNotify(true);
            break;
        }

        cursorColorPresetToggleLight.SetIsOnWithoutNotify(false);
        cursorColorPresetToggleDark.SetIsOnWithoutNotify(false);
        cursorColorPresetToggleLightContrast.SetIsOnWithoutNotify(false);
        cursorColorPresetToggleDarkContrast.SetIsOnWithoutNotify(false);
        cursorColorPresetToggleCustom.SetIsOnWithoutNotify(false);
        switch (SettingsConfig.Config.CursorColorPreset)
        {
        case CursorColourPreset.light:
            cursorColorPresetToggleLight.SetIsOnWithoutNotify(true);
            break;

        case CursorColourPreset.dark:
            cursorColorPresetToggleDark.SetIsOnWithoutNotify(true);
            break;

        case CursorColourPreset.white_Contrast:
            cursorColorPresetToggleLightContrast.SetIsOnWithoutNotify(true);
            break;

        case CursorColourPreset.black_Contrast:
            cursorColorPresetToggleDarkContrast.SetIsOnWithoutNotify(true);
            break;

        case CursorColourPreset.custom:
            cursorColorPresetToggleCustom.SetIsOnWithoutNotify(true);
            break;
        }

        if (SettingsConfig.Config.CursorColorPreset == CursorColourPreset.custom)
        {
            foreach (var label in customCursorColourLabels)
            {
                label.SetActive(true);
            }
        }
        else
        {
            foreach (var label in customCursorColourLabels)
            {
                label.SetActive(false);
            }
        }

        ValidateInteractionTypeElements();

        CTIEnableTog.SetIsOnWithoutNotify(CallToInteractConfig.Config.Enabled);
        CTIShowTimer.SetTextWithoutNotify(CallToInteractConfig.Config.ShowTimeAfterNoHandPresent.ToString("#0.00#"));
        CTIHideTimer.SetTextWithoutNotify(CallToInteractConfig.Config.HideTimeAfterHandPresent.ToString("#0.00#"));

        switch (CallToInteractConfig.Config.hideType)
        {
        case HideRequirement.PRESENT:
            CTIEndOnPresentTog.SetIsOnWithoutNotify(true);
            CTIEndOnInteractionTog.SetIsOnWithoutNotify(false);
            activityHideOption.SetActive(true);
            break;

        case HideRequirement.INTERACTION:
            CTIEndOnPresentTog.SetIsOnWithoutNotify(false);
            CTIEndOnInteractionTog.SetIsOnWithoutNotify(true);
            activityHideOption.SetActive(false);
            break;
        }

        hoverEventsWarning.SetActive(sendHoverEventsTog.isOn);

        LoadCTIFilesIntoDropdown();
        DisplayCursorPreview();
        DisplayIntractionPreview();
    }