Esempio n. 1
0
    private void OnGUI()
    {
        // Draw the title.
        GuiHelpers.DrawText("CALIBRATION", new Vector2(10, 10), 36, GuiHelpers.Magenta);

        if (IsSupportedEngineVersion())
        {
            // Draw the "Recalibrate" button.
            if (GUI.Button(new Rect(10, 70, 150, 30), "Recalibrate"))
            {
                StartWaitingForCalibration();

                _host.LaunchRecalibration();
            }

            // Draw the "Test calibration" button.
            if (GUI.Button(new Rect(10, 110, 150, 30), "Test calibration"))
            {
                _host.LaunchCalibrationTesting();
            }
        }
        else
        {
            // The current engine is not supported.
            GuiHelpers.DrawRequiredEngineVersionError("1.1");
        }
    }
Esempio n. 2
0
    private void OnGUI()
    {
        // Draw the title.
        GuiHelpers.DrawText("PROFILES", new Vector2(10, 10), 36, GuiHelpers.Magenta);

        if (!IsSupportedEngineVersion())
        {
            // The current engine is not supported.
            GuiHelpers.DrawRequiredEngineVersionError("1.3");
            return;
        }

        UpdateProfiles(
            _host.UserProfileNames,
            _host.UserProfileName);
    }
Esempio n. 3
0
    private void UpdateProfiles(
        EyeXEngineStateValue <string[]> profiles,
        EyeXEngineStateValue <string> currentProfile)
    {
        if (profiles.IsValid && currentProfile.IsValid)
        {
            // Draw the title.
            GuiHelpers.DrawText("Click a profile button to activate it.", new Vector2(10, 60), 18, GuiHelpers.Black);

            for (int index = 0; index < profiles.Value.Length; index++)
            {
                // Get the profile name.
                var profileName = profiles.Value[index];

                // Should we disable the GUI?
                var isCurrentProfile = profileName == currentProfile.Value;
                if (isCurrentProfile)
                {
                    GUI.enabled = false;
                }

                // Draw the button.
                var buttonX    = buttonMargin;
                var buttonY    = 100 + (index * (buttonHeight + buttonMargin));
                var buttonRect = new Rect(buttonX, buttonY, buttonWidth, buttonHeight);
                if (GUI.Button(buttonRect, profileName))
                {
                    // Set the current user profile.
                    _host.SetCurrentProfile(profileName);
                }

                // Re-enable the GUI.
                GUI.enabled = true;
            }
        }
        else
        {
            // No valid profile name.
            GuiHelpers.DrawText("Error: Could not retrieve profile names.", new Vector2(10, 60), 18, GuiHelpers.Red);
        }
    }
Esempio n. 4
0
    void OnGUI()
    {
        // Check whether or not the user is present.
        var hasUserPresence = _userPresenceComponent.IsUserPresent ? "Yes" : "No";

        GuiHelpers.DrawText("Is user present?", new Vector2(10, 10), 18, Color.gray);
        GuiHelpers.DrawText(hasUserPresence, new Vector2(160, 10), 18, Color.black);

        // Check whether or not the EyeX Engine is tracking the user's gaze.
        GuiHelpers.DrawText("Is tracking gaze?", new Vector2(10, 40), 18, Color.gray);
        if (_userPresenceComponent.GazeTracking == EyeXGazeTracking.NotSupported)
        {
            // This functionality is not available for the user.
            GuiHelpers.DrawText("Requires EyeX Engine 1.4", new Vector2(160, 40), 18, Color.red);
        }
        else
        {
            var isTrackingGaze = _userPresenceComponent.GazeTracking == EyeXGazeTracking.GazeTracked;
            GuiHelpers.DrawText(isTrackingGaze ? "Yes" : "No", new Vector2(160, 40), 18, Color.black);
        }
    }