private void OnSavePressed()
    {
        GUICommon.Instance.PlayButtonPressSound();

        // Save the new settings to the config file.
        if (!Settings.Instance.Save())
        {
            GD.PrintErr("Failed to save new options menu settings to configuration file.");
            errorAcceptBox.PopupCenteredShrink();
            return;
        }

        // Copy over the new saved settings.
        savedSettings = Settings.Instance.Clone();

        if (optionsMode == OptionsMode.InGame)
        {
            savedTutorialsEnabled = gameProperties.TutorialState.Enabled;
        }

        UpdateResetSaveButtonState();
    }
    /*
     * GUI Control Callbacks
     */

    private void OnBackPressed()
    {
        GUICommon.Instance.PlayButtonPressSound();

        // If any settings have been changed, show a dialogue asking if the changes should be kept or
        // discarded.
        if (!CompareSettings())
        {
            backConfirmationBox.PopupCenteredShrink();
            return;
        }

        EmitSignal(nameof(OnOptionsClosed));
    }
示例#3
0
    public void OnQuickLoad()
    {
        if (!InProgressLoad.IsLoading)
        {
            GD.Print("Quick load pressed, attempting to load latest save");

            if (!SaveHelper.QuickLoad())
            {
                differentVersionDialog.PopupCenteredShrink();
            }
        }
        else
        {
            GD.Print("Quick load pressed, cancelled because another is already in progress");
        }
    }
示例#4
0
    /// <summary>
    ///   Setup the main menu.
    /// </summary>
    private void RunMenuSetup()
    {
        Background      = GetNode <TextureRect>("Background");
        guiAnimations   = GetNode <AnimationPlayer>("GUIAnimations");
        thriveLogo      = GetNode <TextureRect>(ThriveLogoPath);
        newGameButton   = GetNode <Button>(NewGameButtonPath);
        freebuildButton = GetNode <Button>(FreebuildButtonPath);

        MenuArray?.Clear();

        // Get all of menu items
        MenuArray = GetTree().GetNodesInGroup("MenuItem");

        if (MenuArray == null)
        {
            GD.PrintErr("Failed to find all the menu items!");
            return;
        }

        RandomizeBackground();

        options    = GetNode <OptionsMenu>("OptionsMenu");
        saves      = GetNode <SaveManagerGUI>("SaveManagerGUI");
        gles2Popup = GetNode <AcceptDialog>(GLES2PopupPath);

        // Set initial menu
        SwitchMenu();

        // Easter egg message
        thriveLogo.RegisterToolTipForControl(
            ToolTipManager.Instance.GetToolTip("thriveLogoEasterEgg", "mainMenu"), toolTipCallbacks);

        if (OS.GetCurrentVideoDriver() == OS.VideoDriver.Gles2 && !IsReturningToMenu)
        {
            gles2Popup.PopupCenteredShrink();
        }
    }
示例#5
0
 private void OnKnownIncompatibleLoaded()
 {
     loadIncompatibleDialog.PopupCenteredShrink();
 }