protected virtual void OnEnable()
 {
     SettingsConfig.OnConfigUpdated += OnSettingsUpdated;
     OnSettingsUpdated();
     PhysicalConfigurable.CreateVirtualScreen(PhysicalConfigurable.Config);
     positioningModule.Stabiliser.ResetValues();
 }
    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);
        }
    }
예제 #3
0
 public void ResetToDefaultValues()
 {
     PhysicalConfigurable.SetAllValuesToDefault();
     PhysicalConfigurable.SaveConfig();
     LoadConfigValuesIntoFields();
     SaveValuesToConfig();
 }
예제 #4
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);
    }
    private void OnEnable()
    {
        // only show users the screentop option if they have the correct leap service
        if (SingleHandManager.Instance.screenTopAvailable)
        {
            screenTopOption.SetActive(true);
        }
        else
        {
            screenTopOption.SetActive(false);
        }

        ShowCurrentMount();

        // find the leap config path to look for auto orientation
        string appdatapath    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
        string leapConfigPath = Path.Combine(appdatapath, "Leap Motion", "Config.json");

        if (File.Exists(leapConfigPath))
        {
            foreach (var line in File.ReadAllLines(leapConfigPath))
            {
                if (line.Contains("image_processing_auto_flip"))
                {
                    // check if auto orientation is true and warn against it
                    if (line.Contains("true"))
                    {
                        StartCoroutine(EnableWarningAfterWait());
                        return;
                    }
                    else
                    {
                        guideWarning.SetActive(false);
                    }

                    break;
                }
            }
        }

        // we still think the warning should not be shown, double check by:
        // Check if the physicalconfig is set to default
        var defaultConfig = PhysicalConfigurable.GetDefaultValues();

        if (PhysicalConfigurable.Config.ScreenHeightM == defaultConfig.ScreenHeightM &&
            PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM == defaultConfig.LeapPositionRelativeToScreenBottomM)
        {
            StartCoroutine(EnableWarningAfterWait());
        }
        else
        {
            guideWarning.SetActive(false);
        }
    }
예제 #6
0
    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);
    }
예제 #7
0
    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();
    }
예제 #9
0
 protected override void CommitValuesToFile()
 {
     PhysicalConfigurable.SaveConfig();
 }
예제 #10
0
    private void OnEnable()
    {
        // find the leap config path to look for auto orientation
        string appdatapath    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
        string leapConfigPath = Path.Combine(appdatapath, "Leap Motion", "Config.json");

        bool enabling = false;

        if (File.Exists(leapConfigPath))
        {
            foreach (var line in File.ReadAllLines(leapConfigPath))
            {
                if (line.Contains("image_processing_auto_flip"))
                {
                    // check if auto orientation is true and warn against it
                    if (line.Contains("true"))
                    {
                        StartCoroutine(EnableWarningAfterWait());
                        enabling = true;
                    }
                    else
                    {
                        guideWarning.SetActive(false);
                    }

                    break;
                }
            }
        }

        if (!enabling)
        {
            //Check if the physicalconfig is set to default and guide the users if it is
            var defaultConfig = PhysicalConfigurable.GetDefaultValues();

            if (PhysicalConfigurable.Config.ScreenHeightM == defaultConfig.ScreenHeightM &&
                PhysicalConfigurable.Config.LeapPositionRelativeToScreenBottomM == defaultConfig.LeapPositionRelativeToScreenBottomM)
            {
                StartCoroutine(EnableWarningAfterWait());
                enabling = true;
            }
            else
            {
                guideWarning.SetActive(false);
            }
        }

        bottomMountedCurrent.SetActive(false);
        topMountedCurrent.SetActive(false);

        if (!enabling)
        {
            // show the user their currently selected mounting mode
            if (Mathf.Abs(PhysicalConfigurable.Config.LeapRotationD.z) > 90f)
            {
                //top
                topMountedCurrent.SetActive(true);
            }
            else
            {
                //bottom
                bottomMountedCurrent.SetActive(true);
            }
        }
    }