Example #1
0
    /// <summary>
    ///   Registers tooltip for the existing Controls
    /// </summary>
    public void RegisterTooltips()
    {
        foreach (Control organelleSelection in organelleSelectionElements)
        {
            ToolTipHelper.RegisterToolTipForControl(
                organelleSelection, tooltipCallbacks, ToolTipManager.Instance.GetToolTip(
                    organelleSelection.Name, "organelleSelection"));
        }

        foreach (Control membraneSelection in membraneSelectionElements)
        {
            ToolTipHelper.RegisterToolTipForControl(
                membraneSelection, tooltipCallbacks, ToolTipManager.Instance.GetToolTip(
                    membraneSelection.Name, "membraneSelection"));
        }

        ToolTipHelper.RegisterToolTipForControl(
            rigiditySlider, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("rigiditySlider", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            helpButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("helpButton"));
        ToolTipHelper.RegisterToolTipForControl(
            symmetryButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("symmetryButton", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            undoButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("undoButton", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            redoButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("redoButton", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            newCellButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("newCellButton", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            timeIndicator, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("timeIndicator", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            finishButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("finishButton", "editor"));
        ToolTipHelper.RegisterToolTipForControl(
            menuButton, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("menuButton"));
    }
Example #2
0
    public void UpdateEnergyBalanceToolTips(EnergyBalanceInfo energyBalance)
    {
        // Clear previous callbacks
        processesTooltipCallbacks.Clear();

        foreach (var subBar in atpProductionBar.SubBars)
        {
            var tooltip = ToolTipManager.Instance.GetToolTip(subBar.Name, "processesProduction");

            ToolTipHelper.RegisterToolTipForControl(subBar, processesTooltipCallbacks, tooltip);

            tooltip.Description =
                $"{SimulationParameters.Instance.GetOrganelleType(subBar.Name).Name}: " +
                $"+{energyBalance.Production[subBar.Name]} ATP";
        }

        foreach (var subBar in atpConsumptionBar.SubBars)
        {
            var tooltip = ToolTipManager.Instance.GetToolTip(subBar.Name, "processesConsumption");

            ToolTipHelper.RegisterToolTipForControl(subBar, processesTooltipCallbacks, tooltip);

            string displayName;

            switch (subBar.Name)
            {
            case "osmoregulation":
            {
                displayName = "Osmoregulation";
                break;
            }

            case "baseMovement":
            {
                displayName = "Base Movement";
                break;
            }

            default:
            {
                displayName = SimulationParameters.Instance.GetOrganelleType(subBar.Name).Name;
                break;
            }
            }

            tooltip.Description = $"{displayName}: -{energyBalance.Consumption[subBar.Name]} ATP";
        }
    }
Example #3
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);

        // Load settings
        if (Settings.Instance == null)
        {
            GD.PrintErr("Failed to initialize settings.");
        }

        // Set initial menu
        SwitchMenu();

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

        if (OS.GetCurrentVideoDriver() == OS.VideoDriver.Gles2 && !IsReturningToMenu)
        {
            gles2Popup.PopupCenteredMinsize();
        }
    }
Example #4
0
    /// <summary>
    ///   Sets up the inputs and adds them as children.
    /// </summary>
    public override void _Ready()
    {
        inputActionHeader    = GetNode <Label>(InputActionHeaderPath);
        inputEventsContainer = GetNode <HBoxContainer>(InputEventsContainerPath);
        addInputEvent        = GetNode <Button>(AddInputEventPath);

        ToolTipHelper.RegisterToolTipForControl(
            addInputEvent, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("addInputButton", "options"));

        inputActionHeader.Text = DisplayName;

        foreach (var input in Inputs)
        {
            input.AssociatedAction = new WeakReference <InputActionItem>(this);
            inputEventsContainer.AddChild(input);
        }

        inputEventsContainer.MoveChild(addInputEvent, Inputs.Count);

        Inputs.CollectionChanged += OnInputsChanged;
    }