Exemplo n.º 1
0
    private void InputDefaultsConfirm()
    {
        Settings.Instance.CurrentControls.Value = InputGroupList.GetDefaultControls();
        Settings.Instance.ApplyInputSettings();
        BuildInputRebindControls();

        UpdateResetSaveButtonState();
    }
Exemplo n.º 2
0
    private bool CheckNewKeyConflicts(InputEvent @event, InputGroupList groupList, SpecifiedInputKey?old)
    {
        // Get the conflicts with the new input.
        var conflict = groupList.Conflicts(this);

        if (conflict != null)
        {
            AssociatedEvent = old;

            // If there are conflicts detected reset the changes and ask the user.
            groupList.ShowInputConflictDialog(this, conflict, (InputEventWithModifiers)@event);
            return(true);
        }

        var associatedAction = Action;

        if (associatedAction?.Inputs == null)
        {
            GD.PrintErr("Can't check conflicts because associated action or its inputs is null");
            return(false);
        }

        // Check if the input is already defined for this action
        // This code works by finding a pair
        for (var i = 0; i < associatedAction.Inputs.Count; i++)
        {
            for (var x = i + 1; x < associatedAction.Inputs.Count; x++)
            {
                // Pair found (input already defined)
                if (!associatedAction.Inputs[i].Equals(associatedAction.Inputs[x]))
                {
                    continue;
                }

                // Set AssociatedEvent to null to not delete the wrong InputEventItem,
                // because Equals treats it the same with the same AssociatedEvent.
                AssociatedEvent = null;
                Delete();
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 3
0
    public override void _Ready()
    {
        // Options control buttons
        resetButton = GetNode <Button>(ResetButtonPath);
        saveButton  = GetNode <Button>(SaveButtonPath);

        // Tab selector buttons
        graphicsButton    = GetNode <Button>(GraphicsButtonPath);
        soundButton       = GetNode <Button>(SoundButtonPath);
        performanceButton = GetNode <Button>(PerformanceButtonPath);
        inputsButton      = GetNode <Button>(InputsButtonPath);
        miscButton        = GetNode <Button>(MiscButtonPath);

        // Graphics
        graphicsTab               = GetNode <Control>(GraphicsTabPath);
        vsync                     = GetNode <CheckBox>(VSyncPath);
        fullScreen                = GetNode <CheckBox>(FullScreenPath);
        msaaResolution            = GetNode <OptionButton>(MSAAResolutionPath);
        colourblindSetting        = GetNode <OptionButton>(ColourblindSettingPath);
        chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath);
        chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath);

        // Sound
        soundTab            = GetNode <Control>(SoundTabPath);
        masterVolume        = GetNode <Slider>(MasterVolumePath);
        masterMuted         = GetNode <CheckBox>(MasterMutedPath);
        musicVolume         = GetNode <Slider>(MusicVolumePath);
        musicMuted          = GetNode <CheckBox>(MusicMutedPath);
        ambianceVolume      = GetNode <Slider>(AmbianceVolumePath);
        ambianceMuted       = GetNode <CheckBox>(AmbianceMutedPath);
        sfxVolume           = GetNode <Slider>(SFXVolumePath);
        sfxMuted            = GetNode <CheckBox>(SFXMutedPath);
        guiVolume           = GetNode <Slider>(GUIVolumePath);
        guiMuted            = GetNode <CheckBox>(GUIMutedPath);
        languageSelection   = GetNode <OptionButton>(LanguageSelectionPath);
        resetLanguageButton = GetNode <Button>(ResetLanguageButtonPath);
        LoadLanguages(languageSelection);

        // Performance
        performanceTab           = GetNode <Control>(PerformanceTabPath);
        cloudInterval            = GetNode <OptionButton>(CloudIntervalPath);
        cloudResolution          = GetNode <OptionButton>(CloudResolutionPath);
        runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath);

        // Inputs
        inputsTab      = GetNode <Control>(InputsTabPath);
        inputGroupList = GetNode <InputGroupList>(InputGroupListPath);
        inputGroupList.OnControlsChanged += OnControlsChanged;

        // Misc
        miscTab                   = GetNode <Control>(MiscTabPath);
        playIntro                 = GetNode <CheckBox>(PlayIntroPath);
        playMicrobeIntro          = GetNode <CheckBox>(PlayMicrobeIntroPath);
        tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath);
        cheats                = GetNode <CheckBox>(CheatsPath);
        autoSave              = GetNode <CheckBox>(AutoSavePath);
        maxAutoSaves          = GetNode <SpinBox>(MaxAutoSavesPath);
        maxQuickSaves         = GetNode <SpinBox>(MaxQuickSavesPath);
        tutorialsEnabled      = GetNode <CheckBox>(TutorialsEnabledPath);
        customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath);
        customUsername        = GetNode <LineEdit>(CustomUsernamePath);

        backConfirmationBox     = GetNode <AcceptDialog>(BackConfirmationBoxPath);
        defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath);
        errorAcceptBox          = GetNode <AcceptDialog>(ErrorAcceptBoxPath);

        selectedOptionsTab = SelectedOptionsTab.Graphics;

        // We're only utilizing the AcceptDialog's auto resize functionality,
        // so hide the default Ok button since it's not needed
        backConfirmationBox.GetOk().Hide();
    }
Exemplo n.º 4
0
    public override void _Ready()
    {
        // Options control buttons
        resetButton = GetNode <Button>(ResetButtonPath);
        saveButton  = GetNode <Button>(SaveButtonPath);

        // Tab selector buttons
        graphicsButton    = GetNode <Button>(GraphicsButtonPath);
        soundButton       = GetNode <Button>(SoundButtonPath);
        performanceButton = GetNode <Button>(PerformanceButtonPath);
        inputsButton      = GetNode <Button>(InputsButtonPath);
        miscButton        = GetNode <Button>(MiscButtonPath);

        // Graphics
        graphicsTab                  = GetNode <Control>(GraphicsTabPath);
        vsync                        = GetNode <CustomCheckBox>(VSyncPath);
        fullScreen                   = GetNode <CustomCheckBox>(FullScreenPath);
        msaaResolution               = GetNode <OptionButton>(MSAAResolutionPath);
        maxFramesPerSecond           = GetNode <OptionButton>(MaxFramesPerSecondPath);
        colourblindSetting           = GetNode <OptionButton>(ColourblindSettingPath);
        chromaticAberrationToggle    = GetNode <CustomCheckBox>(ChromaticAberrationTogglePath);
        chromaticAberrationSlider    = GetNode <Slider>(ChromaticAberrationSliderPath);
        displayAbilitiesHotBarToggle = GetNode <CustomCheckBox>(DisplayAbilitiesBarTogglePath);
        guiLightEffectsToggle        = GetNode <CustomCheckBox>(GUILightEffectsTogglePath);

        // Sound
        soundTab                   = GetNode <Control>(SoundTabPath);
        masterVolume               = GetNode <Slider>(MasterVolumePath);
        masterMuted                = GetNode <CustomCheckBox>(MasterMutedPath);
        musicVolume                = GetNode <Slider>(MusicVolumePath);
        musicMuted                 = GetNode <CustomCheckBox>(MusicMutedPath);
        ambianceVolume             = GetNode <Slider>(AmbianceVolumePath);
        ambianceMuted              = GetNode <CustomCheckBox>(AmbianceMutedPath);
        sfxVolume                  = GetNode <Slider>(SFXVolumePath);
        sfxMuted                   = GetNode <CustomCheckBox>(SFXMutedPath);
        guiVolume                  = GetNode <Slider>(GUIVolumePath);
        guiMuted                   = GetNode <CustomCheckBox>(GUIMutedPath);
        audioOutputDeviceSelection = GetNode <OptionButton>(AudioOutputDeviceSelectionPath);
        languageSelection          = GetNode <OptionButton>(LanguageSelectionPath);
        resetLanguageButton        = GetNode <Button>(ResetLanguageButtonPath);
        languageProgressLabel      = GetNode <Label>(LanguageProgressLabelPath);

        LoadLanguages();
        LoadAudioOutputDevices();

        // Performance
        performanceTab           = GetNode <Control>(PerformanceTabPath);
        cloudInterval            = GetNode <OptionButton>(CloudIntervalPath);
        cloudResolutionTitle     = GetNode <VBoxContainer>(CloudResolutionTitlePath);
        cloudResolution          = GetNode <OptionButton>(CloudResolutionPath);
        runAutoEvoDuringGameplay = GetNode <CustomCheckBox>(RunAutoEvoDuringGameplayPath);
        detectedCPUCount         = GetNode <Label>(DetectedCPUCountPath);
        activeThreadCount        = GetNode <Label>(ActiveThreadCountPath);
        assumeHyperthreading     = GetNode <CustomCheckBox>(AssumeHyperthreadingPath);
        useManualThreadCount     = GetNode <CustomCheckBox>(UseManualThreadCountPath);
        threadCountSlider        = GetNode <Slider>(ThreadCountSliderPath);

        // Inputs
        inputsTab      = GetNode <Control>(InputsTabPath);
        inputGroupList = GetNode <InputGroupList>(InputGroupListPath);
        inputGroupList.OnControlsChanged += OnControlsChanged;

        // Misc
        miscTab                   = GetNode <Control>(MiscTabPath);
        playIntro                 = GetNode <CustomCheckBox>(PlayIntroPath);
        playMicrobeIntro          = GetNode <CustomCheckBox>(PlayMicrobeIntroPath);
        tutorialsEnabledOnNewGame = GetNode <CustomCheckBox>(TutorialsEnabledOnNewGamePath);
        cheats                        = GetNode <CustomCheckBox>(CheatsPath);
        autoSave                      = GetNode <CustomCheckBox>(AutoSavePath);
        maxAutoSaves                  = GetNode <SpinBox>(MaxAutoSavesPath);
        maxQuickSaves                 = GetNode <SpinBox>(MaxQuickSavesPath);
        tutorialsEnabled              = GetNode <CustomCheckBox>(TutorialsEnabledPath);
        customUsernameEnabled         = GetNode <CustomCheckBox>(CustomUsernameEnabledPath);
        customUsername                = GetNode <LineEdit>(CustomUsernamePath);
        jsonDebugMode                 = GetNode <OptionButton>(JSONDebugModePath);
        unsavedProgressWarningEnabled = GetNode <CustomCheckBox>(UnsavedProgressWarningPath);

        screenshotDirectoryWarningBox = GetNode <CustomConfirmationDialog>(ScreenshotDirectoryWarningBoxPath);
        backConfirmationBox           = GetNode <CustomDialog>(BackConfirmationBoxPath);
        defaultsConfirmationBox       = GetNode <CustomConfirmationDialog>(DefaultsConfirmationBoxPath);
        errorAcceptBox = GetNode <ErrorDialog>(ErrorAcceptBoxPath);

        selectedOptionsTab = SelectedOptionsTab.Graphics;

        cloudResolutionTitle.RegisterToolTipForControl("cloudResolution", "options");
        guiLightEffectsToggle.RegisterToolTipForControl("guiLightEffects", "options");
        assumeHyperthreading.RegisterToolTipForControl("assumeHyperthreading", "options");
        unsavedProgressWarningEnabled.RegisterToolTipForControl("unsavedProgressWarning", "options");
    }