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);
        }
    }
Example #2
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);
            }
        }
    }