void RunAutoOrManual()
    {
        if (manualConfigKeyEntered == "A")
        {
            ChangeState(ConfigState.AUTO);
        }
        else if (manualConfigKeyEntered == "M")
        {
            // immediately use the selecte dmount type for manual setup
            var  setup            = PhysicalConfigurable.Config;
            bool wasBottomMounted = Mathf.Approximately(0, setup.LeapRotationD.z);

            if (wasBottomMounted && selectedMountType == MountingType.OVERHEAD)
            {
                setup.LeapRotationD = new Vector3(-setup.LeapRotationD.x, setup.LeapRotationD.y, 180f);
                PhysicalConfigurable.UpdateConfig(setup);
            }
            else if (!wasBottomMounted && selectedMountType == MountingType.BOTTOM)
            {
                setup.LeapRotationD = new Vector3(-setup.LeapRotationD.x, setup.LeapRotationD.y, 0f);
                PhysicalConfigurable.UpdateConfig(setup);
            }

            // dont alloe manual to flip the axes again
            selectedMountType = MountingType.NONE;
            ChangeState(ConfigState.MANUAL);
        }
    }
Beispiel #2
0
    void CompleteAutoConfig(Vector3 bottomPos, Vector3 topPos)
    {
        PhysicalConfigurable.SetAllValuesToDefault();
        var setup = CalculateConfigurationValues(bottomPos, topPos);


        PhysicalConfigurable.UpdateConfig(setup);
        PhysicalConfigurable.SaveConfig();
        ConfigurationSetupController.Instance.ChangeState(ConfigState.AUTO_COMPLETE);
    }
    void CompleteAutoConfig(Vector3 bottomPos, Vector3 topPos)
    {
        PhysicalConfigurable.SetAllValuesToDefault();
        var setup = CalculateConfigurationValues(bottomPos, topPos);

        // Make sure that past this point the selected mount type has been reset as it has been used above
        ConfigurationSetupController.selectedMountType = MountingType.NONE;

        PhysicalConfigurable.UpdateConfig(setup);
        PhysicalConfigurable.SaveConfig();
        ConfigurationSetupController.Instance.ChangeState(ConfigState.AUTO_COMPLETE);
    }
    protected override void SaveValuesToConfig()
    {
        var setup = PhysicalConfigurable.Config;

        setup.ScreenRotationD = TryParseNewStringToFloat(ref setup.ScreenRotationD, PhysicalScreenTiltAngle.text);
        setup.ScreenHeightM   = TryParseNewStringToFloat(ref setup.ScreenHeightM, ScreenHeight.text, true);
        setup.LeapPositionRelativeToScreenBottomM = new Vector3(
            TryParseNewStringToFloat(ref setup.LeapPositionRelativeToScreenBottomM.x, TrackingOriginX.text, true),
            TryParseNewStringToFloat(ref setup.LeapPositionRelativeToScreenBottomM.y, TrackingOriginY.text, true),
            -TryParseNewStringToFloat(ref setup.LeapPositionRelativeToScreenBottomM.z, TrackingOriginZ.text, true)
            );
        setup.LeapRotationD = new Vector3(
            TryParseNewStringToFloat(ref setup.LeapRotationD.x, TrackingRotationX.text),
            setup.LeapRotationD.y,
            setup.LeapRotationD.z
            );

        PhysicalConfigurable.UpdateConfig(setup);
        RestartSaveConfigTimer();
    }
    public void SetResolution()
    {
        var width  = int.Parse(resolutionWidth.text);
        var height = int.Parse(resolutionHeight.text);

        if (width < 200)
        {
            width = 200;
            resolutionWidth.text = "200";
        }

        if (height < 200)
        {
            height = 200;
            resolutionHeight.text = "200";
        }

        GlobalSettings.ScreenWidth  = width;
        GlobalSettings.ScreenHeight = height;
        PhysicalConfigurable.UpdateConfig(PhysicalConfigurable.Config);
        ConfigurationSetupController.Instance.RefreshConfigActive();
        OnValueChanged();
    }