public GrinderMenu(ReagentGrinderBoundUserInterface owner = null)
            {
                Owner = owner;
                Title = Loc.GetString("All-In-One Grinder 3000");

                var hSplit = new HBoxContainer
                {
                    SizeFlagsHorizontal = SizeFlags.Fill,
                    SizeFlagsVertical   = SizeFlags.Fill
                };

                var vBoxGrindJuiceButtonPanel = new VBoxContainer
                {
                    SizeFlagsVertical = SizeFlags.ShrinkCenter
                };

                GrindButton = new Button
                {
                    Text              = Loc.GetString("Grind"),
                    TextAlign         = Label.AlignMode.Center,
                    CustomMinimumSize = (64, 64)
                };

                JuiceButton = new Button
                {
                    Text              = Loc.GetString("Juice"),
                    TextAlign         = Label.AlignMode.Center,
                    CustomMinimumSize = (64, 64)
                };

                vBoxGrindJuiceButtonPanel.AddChild(GrindButton);
                //inner button padding
                vBoxGrindJuiceButtonPanel.AddChild(new Control
                {
                    CustomMinimumSize = (0, 16),
                });
示例#2
0
        private void AddTranslation(VBoxContainer keys, GridContainer values, VBoxContainer englishContainer, string key, string english, Dictionary <string, string> locales)
        {
            var label = new Label()
            {
                Text = key, RectMinSize = new Vector2(0, 32)
            };

            keys.AddChild(label);

            var lineEdit = new LineEdit()
            {
                Text = english, Editable = false
            };

            lineEdit.AddFontOverride("font", UI.InternationalFont);
            englishContainer.AddChild(lineEdit);

            foreach (var lang in Languages.GetList())
            {
                string code = Languages.LanguageToCode(lang);
                if (!locales.ContainsKey(code))
                {
                    locales.Add(code, "");
                }

                lineEdit = new LineEdit()
                {
                    Text = locales[code]
                };
                lineEdit.AddFontOverride("font", UI.InternationalFont);
                values.AddChild(lineEdit);

                var lambda = new LambdaWrapper <string>((str) => locales[code] = str);
                lambda.SelfConnect(lineEdit, "text_changed");
            }
        }
        public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, List <RoundEndPlayerInfo> info)
        {
            Title = Loc.GetString("Round End Summary");

            //Round End Window is split into two tabs, one about the round stats
            //and the other is a list of RoundEndPlayerInfo for each player.
            //This tab would be a good place for things like: "x many people died.",
            //"clown slipped the crew x times.", "x shots were fired this round.", etc.
            //Also good for serious info.
            RoundEndSummaryTab = new VBoxContainer()
            {
                Name = Loc.GetString("Round Information")
            };

            //Tab for listing  unique info per player.
            PlayerManifestoTab = new VBoxContainer()
            {
                Name = Loc.GetString("Player Manifesto")
            };

            RoundEndWindowTabs = new TabContainer();
            RoundEndWindowTabs.AddChild(RoundEndSummaryTab);
            RoundEndWindowTabs.AddChild(PlayerManifestoTab);

            Contents.AddChild(RoundEndWindowTabs);

            //Gamemode Name
            var gamemodeLabel = new RichTextLabel();

            gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm));
            RoundEndSummaryTab.AddChild(gamemodeLabel);

            //Round end text
            if (!string.IsNullOrEmpty(roundEnd))
            {
                var roundEndLabel = new RichTextLabel();
                roundEndLabel.SetMarkup(Loc.GetString(roundEnd));
                RoundEndSummaryTab.AddChild(roundEndLabel);
            }

            //Duration
            var roundTimeLabel = new RichTextLabel();

            roundTimeLabel.SetMarkup(Loc.GetString("It lasted for [color=yellow]{0} hours, {1} minutes, and {2} seconds.",
                                                   roundTimeSpan.Hours, roundTimeSpan.Minutes, roundTimeSpan.Seconds));
            RoundEndSummaryTab.AddChild(roundTimeLabel);

            //Initialize what will be the list of players display.
            var scrollContainer = new ScrollContainer();

            scrollContainer.SizeFlagsVertical = SizeFlags.FillExpand;
            var innerScrollContainer = new VBoxContainer();

            //Put observers at the bottom of the list. Put antags on top.
            var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);

            //Create labels for each player info.
            foreach (var playerInfo in manifestSortedList)
            {
                var playerInfoText = new RichTextLabel()
                {
                    SizeFlagsVertical = SizeFlags.Fill,
                };

                if (playerInfo.Observer)
                {
                    playerInfoText.SetMarkup(
                        Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
                                      playerInfo.PlayerOOCName, playerInfo.PlayerICName));
                }
                else
                {
                    //TODO: On Hover display a popup detailing more play info.
                    //For example: their antag goals and if they completed them sucessfully.
                    var icNameColor = playerInfo.Antag ? "red" : "white";
                    playerInfoText.SetMarkup(
                        Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
                                      playerInfo.PlayerOOCName, icNameColor, playerInfo.PlayerICName, Loc.GetString(playerInfo.Role)));
                }
                innerScrollContainer.AddChild(playerInfoText);
            }

            scrollContainer.AddChild(innerScrollContainer);
            //Attach the entire ScrollContainer that holds all the playerinfo.
            PlayerManifestoTab.AddChild(scrollContainer);
            // TODO: 1240 Overlap, remove once it's fixed. Temp Hack to make the lines not overlap
            PlayerManifestoTab.OnVisibilityChanged += PlayerManifestoTab_OnVisibilityChanged;

            //Finally, display the window.
            OpenCentered();
            MoveToFront();
        }
示例#4
0
        public override void _Ready()
        {
            base._Ready();

            editorInterface = GodotSharpEditor.Instance.GetEditorInterface();

            var editorBaseControl = editorInterface.GetBaseControl();

            SizeFlagsVertical = (int)SizeFlags.ExpandFill;
            SetAnchorsAndMarginsPreset(LayoutPreset.Wide);

            panelTabs = new TabContainer
            {
                TabAlign          = TabContainer.TabAlignEnum.Left,
                RectMinSize       = new Vector2(0, 228) * EditorScale,
                SizeFlagsVertical = (int)SizeFlags.ExpandFill
            };
            panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_bg", editorBaseControl.GetStylebox("DebuggerTabBG", "EditorStyles"));
            AddChild(panelTabs);

            {
                // Builds tab
                panelBuildsTab = new VBoxContainer
                {
                    Name = "Builds".TTR(),
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelTabs.AddChild(panelBuildsTab);

                var toolBarHBox = new HBoxContainer {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(toolBarHBox);

                var buildProjectBtn = new Button
                {
                    Text      = "Build Project".TTR(),
                    FocusMode = FocusModeEnum.None
                };
                buildProjectBtn.Connect("pressed", this, nameof(BuildProjectPressed));
                toolBarHBox.AddChild(buildProjectBtn);

                toolBarHBox.AddSpacer(begin: false);

                warningsBtn = new ToolButton
                {
                    Text       = "Warnings".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                warningsBtn.Connect("toggled", this, nameof(_WarningsToggled));
                toolBarHBox.AddChild(warningsBtn);

                errorsBtn = new ToolButton
                {
                    Text       = "Errors".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                errorsBtn.Connect("toggled", this, nameof(_ErrorsToggled));
                toolBarHBox.AddChild(errorsBtn);

                toolBarHBox.AddSpacer(begin: false);

                viewLogBtn = new Button
                {
                    Text      = "View log".TTR(),
                    FocusMode = FocusModeEnum.None,
                    Visible   = false
                };
                viewLogBtn.Connect("pressed", this, nameof(_ViewLogPressed));
                toolBarHBox.AddChild(viewLogBtn);

                var hsc = new HSplitContainer
                {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    SizeFlagsVertical   = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(hsc);

                buildTabsList = new ItemList {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                buildTabsList.Connect("item_selected", this, nameof(_BuildTabsItemSelected));
                buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected));
                hsc.AddChild(buildTabsList);

                buildTabs = new TabContainer
                {
                    TabAlign            = TabContainer.TabAlignEnum.Left,
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    TabsVisible         = false
                };
                hsc.AddChild(buildTabs);
            }
        }
        public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager)
        {
            _random = IoCManager.Resolve <IRobustRandom>();

            _preferencesManager = preferencesManager;

            var margin = new MarginContainer
            {
                MarginTopOverride    = 10,
                MarginBottomOverride = 10,
                MarginLeftOverride   = 10,
                MarginRightOverride  = 10
            };

            AddChild(margin);

            var vBox = new VBoxContainer();

            margin.AddChild(vBox);

            var middleContainer = new HBoxContainer
            {
                SeparationOverride = 10
            };

            vBox.AddChild(middleContainer);

            var leftColumn = new VBoxContainer();

            middleContainer.AddChild(leftColumn);

            #region Randomize

            {
                var panel = HighlightedContainer();
                var randomizeEverythingButton = new Button
                {
                    Text = Loc.GetString("Randomize everything")
                };
                randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
                panel.AddChild(randomizeEverythingButton);
                leftColumn.AddChild(panel);
            }

            #endregion Randomize

            #region Name

            {
                var panel = HighlightedContainer();
                var hBox  = new HBoxContainer
                {
                    SizeFlagsVertical = SizeFlags.FillExpand
                };
                var nameLabel = new Label {
                    Text = Loc.GetString("Name:")
                };
                _nameEdit = new LineEdit
                {
                    CustomMinimumSize = (270, 0),
                    SizeFlagsVertical = SizeFlags.ShrinkCenter
                };
                _nameEdit.OnTextChanged += args => { SetName(args.Text); };
                var nameRandomButton = new Button
                {
                    Text = Loc.GetString("Randomize"),
                };
                nameRandomButton.OnPressed += args => RandomizeName();
                hBox.AddChild(nameLabel);
                hBox.AddChild(_nameEdit);
                hBox.AddChild(nameRandomButton);
                panel.AddChild(hBox);
                leftColumn.AddChild(panel);
            }

            #endregion Name

            var tabContainer = new TabContainer {
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            vBox.AddChild(tabContainer);

            #region Appearance

            {
                var appearanceVBox = new VBoxContainer();
                tabContainer.AddChild(appearanceVBox);
                tabContainer.SetTabTitle(0, Loc.GetString("Appearance"));

                var sexAndAgeRow = new HBoxContainer
                {
                    SeparationOverride = 10
                };

                appearanceVBox.AddChild(sexAndAgeRow);

                #region Sex

                {
                    var panel    = HighlightedContainer();
                    var hBox     = new HBoxContainer();
                    var sexLabel = new Label {
                        Text = Loc.GetString("Sex:")
                    };

                    var sexButtonGroup = new ButtonGroup();

                    _sexMaleButton = new Button
                    {
                        Text  = Loc.GetString("Male"),
                        Group = sexButtonGroup
                    };
                    _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); };
                    _sexFemaleButton          = new Button
                    {
                        Text  = Loc.GetString("Female"),
                        Group = sexButtonGroup
                    };
                    _sexFemaleButton.OnPressed += args => { SetSex(Sex.Female); };
                    hBox.AddChild(sexLabel);
                    hBox.AddChild(_sexMaleButton);
                    hBox.AddChild(_sexFemaleButton);
                    panel.AddChild(hBox);
                    sexAndAgeRow.AddChild(panel);
                }

                #endregion Sex

                #region Age

                {
                    var panel    = HighlightedContainer();
                    var hBox     = new HBoxContainer();
                    var ageLabel = new Label {
                        Text = Loc.GetString("Age:")
                    };
                    _ageEdit = new LineEdit {
                        CustomMinimumSize = (40, 0)
                    };
                    _ageEdit.OnTextChanged += args =>
                    {
                        if (!int.TryParse(args.Text, out var newAge))
                        {
                            return;
                        }
                        SetAge(newAge);
                    };
                    hBox.AddChild(ageLabel);
                    hBox.AddChild(_ageEdit);
                    panel.AddChild(hBox);
                    sexAndAgeRow.AddChild(panel);
                }

                #endregion Age

                #region Hair

                {
                    var panel = HighlightedContainer();
                    panel.SizeFlagsHorizontal = SizeFlags.None;
                    var hairHBox = new HBoxContainer();

                    _hairPicker = new HairStylePicker();
                    _hairPicker.Populate();

                    _hairPicker.OnHairStylePicked += newStyle =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithHairStyleName(newStyle));
                        IsDirty = true;
                    };

                    _hairPicker.OnHairColorPicked += newColor =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithHairColor(newColor));
                        IsDirty = true;
                    };

                    _facialHairPicker = new FacialHairStylePicker();
                    _facialHairPicker.Populate();

                    _facialHairPicker.OnHairStylePicked += newStyle =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithFacialHairStyleName(newStyle));
                        IsDirty = true;
                    };

                    _facialHairPicker.OnHairColorPicked += newColor =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithFacialHairColor(newColor));
                        IsDirty = true;
                    };

                    hairHBox.AddChild(_hairPicker);
                    hairHBox.AddChild(_facialHairPicker);

                    panel.AddChild(hairHBox);
                    appearanceVBox.AddChild(panel);
                }

                #endregion Hair
            }

            #endregion

            #region Jobs

            {
                var jobList = new VBoxContainer();

                var jobVBox = new VBoxContainer
                {
                    Children =
                    {
                        (_preferenceUnavailableButton = new OptionButton()),
                        new ScrollContainer
                        {
                            SizeFlagsVertical = SizeFlags.FillExpand,
                            Children          =
                            {
                                jobList
                            }
                        }
                    }
                };

                tabContainer.AddChild(jobVBox);

                tabContainer.SetTabTitle(1, Loc.GetString("Jobs"));

                _preferenceUnavailableButton.AddItem(
                    Loc.GetString("Stay in lobby if preference unavailable."),
                    (int)PreferenceUnavailableMode.StayInLobby);
                _preferenceUnavailableButton.AddItem(
                    Loc.GetString("Be an {0} if preference unavailable.",
                                  Loc.GetString(SharedGameTicker.OverflowJobName)),
                    (int)PreferenceUnavailableMode.SpawnAsOverflow);

                _preferenceUnavailableButton.OnItemSelected += args =>
                {
                    _preferenceUnavailableButton.SelectId(args.Id);

                    Profile = Profile.WithPreferenceUnavailable((PreferenceUnavailableMode)args.Id);
                    IsDirty = true;
                };

                _jobPriorities = new List <JobPrioritySelector>();

                foreach (var job in prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name))
                {
                    var selector = new JobPrioritySelector(job);
                    jobList.AddChild(selector);
                    _jobPriorities.Add(selector);

                    selector.PriorityChanged += priority =>
                    {
                        Profile = Profile.WithJobPriority(job.ID, priority);
                        IsDirty = true;

                        if (priority == JobPriority.High)
                        {
                            // Lower any other high priorities to medium.
                            foreach (var jobSelector in _jobPriorities)
                            {
                                if (jobSelector != selector && jobSelector.Priority == JobPriority.High)
                                {
                                    jobSelector.Priority = JobPriority.Medium;
                                    Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium);
                                }
                            }
                        }
                    };
                }
            }

            #endregion

            #region Antags

            {
                var antagList = new VBoxContainer();

                var antagVBox = new VBoxContainer
                {
                    Children =
                    {
                        new ScrollContainer
                        {
                            SizeFlagsVertical = SizeFlags.FillExpand,
                            Children          =
                            {
                                antagList
                            }
                        }
                    }
                };

                tabContainer.AddChild(antagVBox);

                tabContainer.SetTabTitle(2, Loc.GetString("Antags"));

                _antagPreferences = new List <AntagPreferenceSelector>();

                foreach (var antag in prototypeManager.EnumeratePrototypes <AntagPrototype>().OrderBy(a => a.Name))
                {
                    if (!antag.SetPreference)
                    {
                        continue;
                    }
                    var selector = new AntagPreferenceSelector(antag);
                    antagList.AddChild(selector);
                    _antagPreferences.Add(selector);

                    selector.PreferenceChanged += preference =>
                    {
                        Profile = Profile.WithAntagPreference(antag.ID, preference);
                        IsDirty = true;
                    };
                }
            }

            #endregion

            var rightColumn = new VBoxContainer();
            middleContainer.AddChild(rightColumn);

            #region Import/Export

            {
                var panelContainer = HighlightedContainer();
                var hBox           = new HBoxContainer();
                var importButton   = new Button
                {
                    Text     = Loc.GetString("Import"),
                    Disabled = true,
                    ToolTip  = "Not yet implemented!"
                };
                var exportButton = new Button
                {
                    Text     = Loc.GetString("Export"),
                    Disabled = true,
                    ToolTip  = "Not yet implemented!"
                };
                hBox.AddChild(importButton);
                hBox.AddChild(exportButton);
                panelContainer.AddChild(hBox);
                rightColumn.AddChild(panelContainer);
            }

            #endregion Import/Export

            #region Save

            {
                var panel = HighlightedContainer();
                _saveButton = new Button
                {
                    Text = Loc.GetString("Save"),
                    SizeFlagsHorizontal = SizeFlags.ShrinkCenter
                };
                _saveButton.OnPressed += args => { Save(); };
                panel.AddChild(_saveButton);
                rightColumn.AddChild(panel);
            }

            #endregion Save

            if (preferencesManager.ServerDataLoaded)
            {
                LoadServerData();
            }

            preferencesManager.OnServerDataLoaded += LoadServerData;

            IsDirty = false;
        }
示例#6
0
        public override void EnablePlugin()
        {
            base.EnablePlugin();

            if (Instance != null)
            {
                throw new InvalidOperationException();
            }
            Instance = this;

            var editorInterface   = GetEditorInterface();
            var editorBaseControl = editorInterface.GetBaseControl();

            editorSettings = editorInterface.GetEditorSettings();

            errorDialog = new AcceptDialog();
            editorBaseControl.AddChild(errorDialog);

            BottomPanel = new BottomPanel();

            bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR());

            AddChild(new HotReloadAssemblyWatcher {
                Name = "HotReloadAssemblyWatcher"
            });

            menuPopup = new PopupMenu();
            menuPopup.Hide();
            menuPopup.SetAsToplevel(true);

            AddToolSubmenuItem("Mono", menuPopup);

            // TODO: Remove or edit this info dialog once Mono support is no longer in alpha
            {
                menuPopup.AddItem("About C# support".TTR(), (int)MenuOptions.AboutCSharp);
                aboutDialog = new AcceptDialog();
                editorBaseControl.AddChild(aboutDialog);
                aboutDialog.WindowTitle = "Important: C# support is not feature-complete";

                // We don't use DialogText as the default AcceptDialog Label doesn't play well with the TextureRect and CheckBox
                // we'll add. Instead we add containers and a new autowrapped Label inside.

                // Main VBoxContainer (icon + label on top, checkbox at bottom)
                var aboutVBox = new VBoxContainer();
                aboutDialog.AddChild(aboutVBox);

                // HBoxContainer for icon + label
                var aboutHBox = new HBoxContainer();
                aboutVBox.AddChild(aboutHBox);

                var aboutIcon = new TextureRect();
                aboutIcon.Texture = aboutIcon.GetIcon("NodeWarning", "EditorIcons");
                aboutHBox.AddChild(aboutIcon);

                var aboutLabel = new Label();
                aboutHBox.AddChild(aboutLabel);
                aboutLabel.RectMinSize       = new Vector2(600, 150) * EditorScale;
                aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill;
                aboutLabel.Autowrap          = true;
                aboutLabel.Text =
                    "C# support in Godot Engine is in late alpha stage and, while already usable, " +
                    "it is not meant for use in production.\n\n" +
                    "Projects can be exported to Linux, macOS, Windows and Android, but not yet to iOS, HTML5 or UWP. " +
                    "Bugs and usability issues will be addressed gradually over future releases, " +
                    "potentially including compatibility breaking changes as new features are implemented for a better overall C# experience.\n\n" +
                    "If you experience issues with this Mono build, please report them on Godot's issue tracker with details about your system, MSBuild version, IDE, etc.:\n\n" +
                    "        https://github.com/godotengine/godot/issues\n\n" +
                    "Your critical feedback at this stage will play a great role in shaping the C# support in future releases, so thank you!";

                EditorDef("mono/editor/show_info_on_start", true);

                // CheckBox in main container
                aboutDialogCheckBox = new CheckBox {
                    Text = "Show this warning when starting the editor"
                };
                aboutDialogCheckBox.Connect("toggled", this, nameof(_ToggleAboutDialogOnStart));
                aboutVBox.AddChild(aboutDialogCheckBox);
            }

            if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath))
            {
                // Make sure the existing project has Api assembly references configured correctly
                CsProjOperations.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath);
            }
            else
            {
                bottomPanelBtn.Hide();
                menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln);
            }

            menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed));

            var buildButton = new ToolButton
            {
                Text        = "Build",
                HintTooltip = "Build solution",
                FocusMode   = Control.FocusModeEnum.None
            };

            buildButton.Connect("pressed", this, nameof(_BuildSolutionPressed));
            AddControlToContainer(CustomControlContainer.Toolbar, buildButton);

            // External editor settings
            EditorDef("mono/editor/external_editor", ExternalEditorId.None);

            string settingsHintStr = "Disabled";

            if (OS.IsWindows)
            {
                settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
                                   $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
                                   $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
            }
            else if (OS.IsOSX)
            {
                settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
                                   $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
                                   $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
                                   $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
            }
            else if (OS.IsUnixLike())
            {
                settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
                                   $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
                                   $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
            }

            editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
            {
                ["type"]        = Variant.Type.Int,
                ["name"]        = "mono/editor/external_editor",
                ["hint"]        = PropertyHint.Enum,
                ["hint_string"] = settingsHintStr
            });

            // Export plugin
            var exportPlugin = new ExportPlugin();

            AddExportPlugin(exportPlugin);
            exportPlugin.RegisterExportSettings();
            exportPluginWeak = WeakRef(exportPlugin);

            BuildManager.Initialize();
            RiderPathManager.Initialize();

            GodotIdeManager = new GodotIdeManager();
            AddChild(GodotIdeManager);
        }
示例#7
0
        private async Task _moveToPage(int page)
        {
            // TODO: Network overhead optimization potential:
            // Right now, (in NETWORK mode) if I request page 5, it has to cache all 5 pages,
            // now the server obviously (enumerator and all that) has to TOO, but whatever.
            // The waste is that all pages are also SENT, even though we only really care about the fifth at the moment.
            // Because the cache can't have holes (and also the network system is too simplistic at the moment,
            // if you do do a by-page pull and you're way too far along,
            // you'll just get 0 elements which doesn't tell you where it ended but that's kinda necessary.
            if (page < 0)
            {
                page = 0;
            }

            if (page > HighestKnownPage || (!_ended && page == HighestKnownPage))
            {
                if (_ended)
                {
                    // The requested page is higher than the highest page we have (and we know this because the enumerator ended).
                    page = HighestKnownPage;
                }
                else
                {
                    // The page is higher than the highest page we have, but the enumerator hasn't ended yet so that might be valid.
                    // Gotta get more data.
                    await _cacheTo((page + 1) *ElementsPerPage);

                    if (page > HighestKnownPage)
                    {
                        // We tried, but the enumerator ended before we reached our goal.
                        // Oh well.
                        DebugTools.Assert(_ended);
                        page = HighestKnownPage;
                    }
                }
            }

            _elementsVBox.DisposeAllChildren();

            for (var i = page * ElementsPerPage; i < ElementsPerPage * (page + 1) && i < _cache.Count; i++)
            {
                var element = _cache[i];
                ViewVariablesPropertyEditor editor;
                if (element == null)
                {
                    editor = new ViewVariablesPropertyEditorDummy();
                }
                else
                {
                    var type = element.GetType();
                    editor = Instance.ViewVariablesManager.PropertyFor(type);
                }

                var control = editor.Initialize(element, true);
                if (editor is ViewVariablesPropertyEditorReference refEditor)
                {
                    if (_networked)
                    {
                        var iSafe = i;
                        refEditor.OnPressed += () =>
                                               Instance.ViewVariablesManager.OpenVV(
                            new ViewVariablesSessionRelativeSelector(Instance.Session.SessionId,
                                                                     new object[] { new ViewVariablesEnumerableIndexSelector(iSafe), }));
                    }
                    else
                    {
                        refEditor.OnPressed += () => Instance.ViewVariablesManager.OpenVV(element);
                    }
                }
                _elementsVBox.AddChild(control);
            }

            _page = page;

            _updateControls();
        }
示例#8
0
            private void PerformLayout()
            {
                LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);

                var layout = new LayoutContainer();

                AddChild(layout);

                var vBox = new VBoxContainer
                {
                    StyleIdentifier = "mainMenuVBox"
                };

                layout.AddChild(vBox);
                LayoutContainer.SetAnchorPreset(vBox, LayoutContainer.LayoutPreset.TopRight);
                LayoutContainer.SetMarginRight(vBox, -25);
                LayoutContainer.SetMarginTop(vBox, 30);
                LayoutContainer.SetGrowHorizontal(vBox, LayoutContainer.GrowDirection.Begin);

                var logoTexture = _resourceCache.GetResource <TextureResource>("/Textures/Logo/logo.png");
                var logo        = new TextureRect
                {
                    Texture = logoTexture,
                    Stretch = TextureRect.StretchMode.KeepCentered,
                };

                vBox.AddChild(logo);

                var userNameHBox = new HBoxContainer {
                    SeparationOverride = 4
                };

                vBox.AddChild(userNameHBox);
                userNameHBox.AddChild(new Label {
                    Text = "Username:"******"player.name");

                UserNameBox = new LineEdit
                {
                    Text = currentUserName, PlaceHolder = "Username",
                    SizeFlagsHorizontal = SizeFlags.FillExpand
                };

                userNameHBox.AddChild(UserNameBox);

                JoinPublicServerButton = new Button
                {
                    Text            = "Join Public Server",
                    StyleIdentifier = "mainMenu",
                    TextAlign       = Label.AlignMode.Center,
#if !FULL_RELEASE
                    Disabled = true,
                    ToolTip  = "Cannot connect to public server with a debug build."
#endif
                };

                vBox.AddChild(JoinPublicServerButton);

                // Separator.
                vBox.AddChild(new Control {
                    CustomMinimumSize = (0, 2)
                });
        private void SetupHighScoreScreen(Texture backgroundTexture)
        {
            var rootBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = overlayShadowColor
            };

            rootBack.SetPatchMargin(StyleBox.Margin.All, 10);
            _highscoresRootContainer = new PanelContainer
            {
                PanelOverride       = rootBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            var c         = new Color(overlayBackgroundColor.R, overlayBackgroundColor.G, overlayBackgroundColor.B, 220);
            var innerBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = c
            };

            innerBack.SetPatchMargin(StyleBox.Margin.All, 10);
            var menuInnerPanel = new PanelContainer
            {
                PanelOverride       = innerBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            _highscoresRootContainer.AddChild(menuInnerPanel);

            var menuContainer = new VBoxContainer()
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter
            };

            menuContainer.AddChild(new Label {
                Text = "Highscores"
            });
            menuContainer.AddChild(new Control {
                CustomMinimumSize = new Vector2(1, 10)
            });

            var highScoreBox = new HBoxContainer();

            _localHighscoresLabel = new Label
            {
                Align = Label.AlignMode.Center
            };
            highScoreBox.AddChild(_localHighscoresLabel);
            highScoreBox.AddChild(new Control {
                CustomMinimumSize = new Vector2(40, 1)
            });
            _globalHighscoresLabel = new Label
            {
                Align = Label.AlignMode.Center
            };
            highScoreBox.AddChild(_globalHighscoresLabel);
            menuContainer.AddChild(highScoreBox);
            menuContainer.AddChild(new Control {
                CustomMinimumSize = new Vector2(1, 10)
            });
            _highscoreBackButton = new Button
            {
                Text      = "Back",
                TextAlign = Label.AlignMode.Center
            };
            _highscoreBackButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.Pause);
            menuContainer.AddChild(_highscoreBackButton);

            menuInnerPanel.AddChild(menuContainer);
        }
示例#10
0
        private void SetupPauseMenu(Texture backgroundTexture)
        {
            var rootBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = overlayShadowColor
            };

            rootBack.SetPatchMargin(StyleBox.Margin.All, 10);
            _menuRootContainer = new PanelContainer
            {
                PanelOverride       = rootBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            var innerBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = overlayBackgroundColor
            };

            innerBack.SetPatchMargin(StyleBox.Margin.All, 10);
            var menuInnerPanel = new PanelContainer
            {
                PanelOverride       = innerBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            _menuRootContainer.AddChild(menuInnerPanel);


            var menuContainer = new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter
            };

            _newGameButton = new Button
            {
                Text      = "New Game",
                TextAlign = Label.AlignMode.Center
            };
            _newGameButton.OnPressed += (e) =>
            {
                _owner.SendAction(BlockGamePlayerAction.NewGame);
            };
            menuContainer.AddChild(_newGameButton);
            menuContainer.AddChild(new Control {
                CustomMinimumSize = new Vector2(1, 10)
            });

            _scoreBoardButton = new Button
            {
                Text      = "Scoreboard",
                TextAlign = Label.AlignMode.Center
            };
            _scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores);
            menuContainer.AddChild(_scoreBoardButton);
            _unpauseButtonMargin = new Control {
                CustomMinimumSize = new Vector2(1, 10), Visible = false
            };
            menuContainer.AddChild(_unpauseButtonMargin);

            _unpauseButton = new Button
            {
                Text      = "Unpause",
                TextAlign = Label.AlignMode.Center,
                Visible   = false
            };
            _unpauseButton.OnPressed += (e) =>
            {
                _owner.SendAction(BlockGamePlayerAction.Unpause);
            };
            menuContainer.AddChild(_unpauseButton);

            menuInnerPanel.AddChild(menuContainer);
        }
示例#11
0
        private void SetupGameoverScreen(Texture backgroundTexture)
        {
            var rootBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = overlayShadowColor
            };

            rootBack.SetPatchMargin(StyleBox.Margin.All, 10);
            _gameOverRootContainer = new PanelContainer
            {
                PanelOverride       = rootBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            var innerBack = new StyleBoxTexture
            {
                Texture  = backgroundTexture,
                Modulate = overlayBackgroundColor
            };

            innerBack.SetPatchMargin(StyleBox.Margin.All, 10);
            var menuInnerPanel = new PanelContainer
            {
                PanelOverride       = innerBack,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter
            };

            _gameOverRootContainer.AddChild(menuInnerPanel);

            var menuContainer = new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter
            };

            menuContainer.AddChild(new Label {
                Text = "Gameover!", Align = Label.AlignMode.Center
            });
            menuContainer.AddChild(new Control {
                CustomMinimumSize = new Vector2(1, 10)
            });


            _finalScoreLabel = new Label {
                Align = Label.AlignMode.Center
            };
            menuContainer.AddChild(_finalScoreLabel);
            menuContainer.AddChild(new Control {
                CustomMinimumSize = new Vector2(1, 10)
            });

            _finalNewGameButton = new Button
            {
                Text      = "New Game",
                TextAlign = Label.AlignMode.Center
            };
            _finalNewGameButton.OnPressed += (e) =>
            {
                _owner.SendAction(BlockGamePlayerAction.NewGame);
            };
            menuContainer.AddChild(_finalNewGameButton);

            menuInnerPanel.AddChild(menuContainer);
        }
示例#12
0
    private void UpdateShownPatchDetails()
    {
        var patch = mapDrawer.SelectedPatch;

        if (patch == null)
        {
            patchDetails.Visible         = false;
            patchNothingSelected.Visible = true;

            return;
        }

        patchDetails.Visible         = true;
        patchNothingSelected.Visible = false;

        patchName.Text          = patch.Name;
        patchBiome.Text         = "Biome: " + patch.Biome.Name;
        patchPlayerHere.Visible = editor.CurrentPatch == patch;

        // Atmospheric gasses
        patchTemperature.Text = patch.Biome.AverageTemperature + " °C";
        patchPressure.Text    = "20 bar";
        patchLight.Text       = (patch.Biome.Compounds["sunlight"].Dissolved * 100) + "% lux";
        patchOxygen.Text      = (patch.Biome.Compounds["oxygen"].Dissolved * 100) + "%";
        patchNitrogen.Text    = (patch.Biome.Compounds["nitrogen"].Dissolved * 100) + "% ppm";
        patchCO2.Text         = (patch.Biome.Compounds["carbondioxide"].Dissolved * 100) + "% ppm";

        // Compounds
        patchHydrogenSulfide.Text = Math.Round(patch.Biome.Compounds["hydrogensulfide"].Density *
                                               patch.Biome.Compounds["hydrogensulfide"].Amount + GetPatchChunkTotalCompoundAmount(
                                                   patch, "hydrogensulfide"), 3) + "%";

        patchAmmonia.Text = Math.Round(patch.Biome.Compounds["ammonia"].Density *
                                       patch.Biome.Compounds["ammonia"].Amount + GetPatchChunkTotalCompoundAmount(
                                           patch, "ammonia"), 3) + "%";

        patchGlucose.Text = Math.Round(patch.Biome.Compounds["glucose"].Density *
                                       patch.Biome.Compounds["glucose"].Amount + GetPatchChunkTotalCompoundAmount(
                                           patch, "glucose"), 3) + "%";

        patchPhosphate.Text = Math.Round(patch.Biome.Compounds["phosphates"].Density *
                                         patch.Biome.Compounds["phosphates"].Amount + GetPatchChunkTotalCompoundAmount(
                                             patch, "phosphates"), 3) + "%";

        patchIron.Text = GetPatchChunkTotalCompoundAmount(patch, "iron") + "%";

        // Delete previous species list
        if (speciesList.GetChildCount() > 0)
        {
            foreach (Node child in speciesList.GetChildren())
            {
                child.QueueFree();
            }
        }

        foreach (var species in patch.SpeciesInPatch.Keys)
        {
            var speciesLabel = new Label();
            speciesLabel.Text = species.FormattedName + " with population: " + species.Population;
            speciesList.AddChild(speciesLabel);
        }

        // Enable move to patch button if this is a valid move
        moveToPatchButton.Disabled = !editor.IsPatchMoveValid(patch);

        UpdateConditionDifferencesBetweenPatches(patch, editor.CurrentPatch);
    }
        public CharacterSetupGui(IEntityManager entityManager,
                                 ILocalizationManager localization,
                                 IResourceCache resourceCache,
                                 IClientPreferencesManager preferencesManager,
                                 IPrototypeManager prototypeManager)
        {
            _entityManager      = entityManager;
            _preferencesManager = preferencesManager;
            var margin = new MarginContainer
            {
                MarginBottomOverride = 20,
                MarginLeftOverride   = 20,
                MarginRightOverride  = 20,
                MarginTopOverride    = 20
            };

            AddChild(margin);

            var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = new Color(37, 37, 42)
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            var panel = new PanelContainer
            {
                PanelOverride = back
            };

            margin.AddChild(panel);

            var vBox = new VBoxContainer {
                SeparationOverride = 0
            };

            margin.AddChild(vBox);

            CloseButton = new Button
            {
                SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd,
                Text         = localization.GetString("Save and close"),
                StyleClasses = { NanoStyle.StyleClassButtonBig }
            };

            var topHBox = new HBoxContainer
            {
                CustomMinimumSize = (0, 40),
                Children          =
                {
                    new MarginContainer
                    {
                        MarginLeftOverride = 8,
                        Children           =
                        {
                            new Label
                            {
                                Text                = localization.GetString("Character Setup"),
                                StyleClasses        = { NanoStyle.StyleClassLabelHeadingBigger },
                                VAlign              = Label.VAlignMode.Center,
                                SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
                            }
                        }
                    },
                    CloseButton
                }
            };

            vBox.AddChild(topHBox);

            vBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = NanoStyle.NanoGold,
                    ContentMarginTopOverride = 2
                }
            });

            var hBox = new HBoxContainer
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            _charactersVBox = new VBoxContainer();

            hBox.AddChild(new MarginContainer
            {
                CustomMinimumSize   = (330, 0),
                SizeFlagsHorizontal = SizeFlags.Fill,
                MarginTopOverride   = 5,
                MarginLeftOverride  = 5,
                Children            =
                {
                    new ScrollContainer
                    {
                        SizeFlagsVertical = SizeFlags.FillExpand,
                        Children          =
                        {
                            _charactersVBox
                        }
                    }
                }
            });
示例#14
0
        public SandboxWindow()
        {
            Resizable = false;
            _gameHud  = IoCManager.Resolve <IGameHud>();

            Title = "Sandbox Panel";

            var vBox = new VBoxContainer {
                SeparationOverride = 4
            };

            Contents.AddChild(vBox);

            RespawnButton = new Button {
                Text = Loc.GetString("Respawn")
            };
            vBox.AddChild(RespawnButton);

            SpawnEntitiesButton = new Button {
                Text = Loc.GetString("Spawn Entities")
            };
            vBox.AddChild(SpawnEntitiesButton);

            SpawnTilesButton = new Button {
                Text = Loc.GetString("Spawn Tiles")
            };
            vBox.AddChild(SpawnTilesButton);

            GiveFullAccessButton = new Button {
                Text = Loc.GetString("Grant Full Access")
            };
            vBox.AddChild(GiveFullAccessButton);

            GiveAghostButton = new Button {
                Text = Loc.GetString("Ghost")
            };
            vBox.AddChild(GiveAghostButton);

            ToggleLightButton = new Button {
                Text = Loc.GetString("Toggle Lights"), ToggleMode = true, Pressed = !IoCManager.Resolve <ILightManager>().Enabled
            };
            vBox.AddChild(ToggleLightButton);

            ToggleFovButton = new Button {
                Text = Loc.GetString("Toggle FOV"), ToggleMode = true, Pressed = !IoCManager.Resolve <IEyeManager>().CurrentEye.DrawFov
            };
            vBox.AddChild(ToggleFovButton);

            ToggleShadowsButton = new Button {
                Text = Loc.GetString("Toggle Shadows"), ToggleMode = true, Pressed = !IoCManager.Resolve <ILightManager>().DrawShadows
            };
            vBox.AddChild(ToggleShadowsButton);

            ToggleSubfloorButton = new Button {
                Text = Loc.GetString("Toggle Subfloor"), ToggleMode = true, Pressed = EntitySystem.Get <SubFloorHideSystem>().EnableAll
            };
            vBox.AddChild(ToggleSubfloorButton);

            SuicideButton = new Button {
                Text = Loc.GetString("Suicide")
            };
            vBox.AddChild(SuicideButton);

            ShowMarkersButton = new Button {
                Text = Loc.GetString("Show Spawns"), ToggleMode = true, Pressed = EntitySystem.Get <MarkerSystem>().MarkersVisible
            };
            vBox.AddChild(ShowMarkersButton);

            ShowBbButton = new Button {
                Text = Loc.GetString("Show BB"), ToggleMode = true, Pressed = IoCManager.Resolve <IDebugDrawing>().DebugColliders
            };
            vBox.AddChild(ShowBbButton);

            MachineLinkingButton = new Button {
                Text = Loc.GetString("Link machines"), ToggleMode = true
            };
            vBox.AddChild(MachineLinkingButton);
        }
        public ConstructionMenu()
        {
            IoCManager.InjectDependencies(this);
            Placement = (PlacementManager)IoCManager.Resolve <IPlacementManager>();
            Placement.PlacementCanceled += OnPlacementCanceled;

            Title = "Construction";

            var hSplitContainer = new HSplitContainer();

            // Left side
            var recipes = new VBoxContainer {
                CustomMinimumSize = new Vector2(150.0f, 0.0f)
            };

            SearchBar = new LineEdit {
                PlaceHolder = "Search"
            };
            RecipeList = new Tree {
                SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true
            };
            recipes.AddChild(SearchBar);
            recipes.AddChild(RecipeList);
            hSplitContainer.AddChild(recipes);

            // Right side
            var guide = new VBoxContainer();
            var info  = new HBoxContainer();

            InfoIcon  = new TextureRect();
            InfoLabel = new Label
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter
            };
            info.AddChild(InfoIcon);
            info.AddChild(InfoLabel);
            guide.AddChild(info);

            var stepsLabel = new Label
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
                SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                Text = "Steps"
            };

            guide.AddChild(stepsLabel);

            StepList = new ItemList
            {
                SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.None
            };
            guide.AddChild(StepList);

            var buttonsContainer = new HBoxContainer();

            BuildButton = new Button
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                TextAlign           = Label.AlignMode.Center,
                Text       = "Build!",
                Disabled   = true,
                ToggleMode = false
            };
            EraseButton = new Button
            {
                TextAlign = Label.AlignMode.Center, Text = "Clear Ghosts", ToggleMode = true
            };
            buttonsContainer.AddChild(BuildButton);
            buttonsContainer.AddChild(EraseButton);
            guide.AddChild(buttonsContainer);

            hSplitContainer.AddChild(guide);
            Contents.AddChild(hSplitContainer);

            BuildButton.OnPressed     += OnBuildPressed;
            EraseButton.OnToggled     += OnEraseToggled;
            SearchBar.OnTextChanged   += OnTextEntered;
            RecipeList.OnItemSelected += OnItemSelected;

            PopulatePrototypeList();
            PopulateTree();
        }
示例#16
0
        public GasTankWindow(GasTankBoundUserInterface owner)
        {
            TextureButton btnClose;

            _resourceCache = IoCManager.Resolve <IResourceCache>();
            _owner         = owner;
            var rootContainer = new LayoutContainer {
                Name = "GasTankRoot"
            };

            AddChild(rootContainer);

            MouseFilter = MouseFilterMode.Stop;

            var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = Color.FromHex("#25252A"),
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            var topPanel = new PanelContainer
            {
                PanelOverride = back,
                MouseFilter   = MouseFilterMode.Pass
            };

            var bottomWrap = new LayoutContainer
            {
                Name = "BottomWrap"
            };

            rootContainer.AddChild(topPanel);
            rootContainer.AddChild(bottomWrap);

            LayoutContainer.SetAnchorPreset(topPanel, LayoutContainer.LayoutPreset.Wide);
            LayoutContainer.SetMarginBottom(topPanel, -85);

            LayoutContainer.SetAnchorPreset(bottomWrap, LayoutContainer.LayoutPreset.VerticalCenterWide);
            LayoutContainer.SetGrowHorizontal(bottomWrap, LayoutContainer.GrowDirection.Both);


            var topContainerWrap = new VBoxContainer
            {
                Children =
                {
                    (_topContainer = new VBoxContainer()),
                    new Control {
                        MinSize    = (0, 110)
                    }
                }
            };

            rootContainer.AddChild(topContainerWrap);

            LayoutContainer.SetAnchorPreset(topContainerWrap, LayoutContainer.LayoutPreset.Wide);

            var font = _resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 13);

            var topRow = new HBoxContainer
            {
                Margin   = new Thickness(4, 2, 12, 2),
                Children =
                {
                    (_lblName               = new Label
                    {
                        Text                = Loc.GetString("Gas Tank"),
                        FontOverride        = font,
                        FontColorOverride   = StyleNano.NanoGold,
                        VerticalAlignment   = VAlignment.Center,
                        HorizontalExpand    = true,
                        HorizontalAlignment = HAlignment.Left,
                        Margin              = new Thickness(0,0, 20, 0),
                    }),
                    (btnClose               = new TextureButton
                    {
                        StyleClasses        = { SS14Window.StyleClassWindowCloseButton },
                        VerticalAlignment   = VAlignment.Center
                    })
                }
            };

            var middle = new PanelContainer
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = Color.FromHex("#202025")
                },
                Children =
                {
                    (_contentContainer = new VBoxContainer
                    {
                        Margin         = new Thickness(8,4),
                    })
                }
            };

            _topContainer.AddChild(topRow);
            _topContainer.AddChild(new PanelContainer
            {
                MinSize       = (0, 2),
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = Color.FromHex("#525252ff")
                }
            });
示例#17
0
            private void PerformLayout()
            {
                MouseFilter = MouseFilterMode.Ignore;

                SetAnchorAndMarginPreset(LayoutPreset.Wide);

                var vBox = new VBoxContainer
                {
                    AnchorLeft      = 1,
                    AnchorRight     = 1,
                    AnchorBottom    = 0,
                    AnchorTop       = 0,
                    MarginTop       = 30,
                    MarginLeft      = -350,
                    MarginRight     = -25,
                    MarginBottom    = 0,
                    StyleIdentifier = "mainMenuVBox",
                };

                AddChild(vBox);

                var logoTexture = _resourceCache.GetResource <TextureResource>("/Textures/Logo/logo.png");
                var logo        = new TextureRect
                {
                    Texture = logoTexture,
                    Stretch = TextureRect.StretchMode.KeepCentered,
                };

                vBox.AddChild(logo);

                var userNameHBox = new HBoxContainer {
                    SeparationOverride = 4
                };

                vBox.AddChild(userNameHBox);
                userNameHBox.AddChild(new Label {
                    Text = "Username:"******"player.name");

                UserNameBox = new LineEdit
                {
                    Text = currentUserName, PlaceHolder = "Username",
                    SizeFlagsHorizontal = SizeFlags.FillExpand
                };

                userNameHBox.AddChild(UserNameBox);

                JoinPublicServerButton = new Button
                {
                    Text      = "Join Public Server",
                    TextAlign = Button.AlignMode.Center,
#if !FULL_RELEASE
                    Disabled = true,
                    ToolTip  = "Cannot connect to public server with a debug build."
#endif
                };

                vBox.AddChild(JoinPublicServerButton);

                // Separator.
                vBox.AddChild(new Control {
                    CustomMinimumSize = (0, 2)
                });
示例#18
0
        public ActionsUI(ClientActionsComponent actionsComponent)
        {
            _actionsComponent = actionsComponent;
            _actionManager    = IoCManager.Resolve <ActionManager>();
            _entityManager    = IoCManager.Resolve <IEntityManager>();
            _gameTiming       = IoCManager.Resolve <IGameTiming>();
            _gameHud          = IoCManager.Resolve <IGameHud>();
            _menu             = new ActionMenu(_actionsComponent, this);

            LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.End);
            LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.End);
            LayoutContainer.SetAnchorTop(this, 0f);
            LayoutContainer.SetAnchorBottom(this, 0.8f);
            LayoutContainer.SetMarginLeft(this, 13);
            LayoutContainer.SetMarginTop(this, 110);

            SizeFlagsHorizontal = SizeFlags.None;
            SizeFlagsVertical   = SizeFlags.FillExpand;

            var resourceCache = IoCManager.Resolve <IResourceCache>();

            // everything needs to go within an inner panel container so the panel resizes to fit the elements.
            // Because ActionsUI is being anchored by layoutcontainer, the hotbar backing would appear too tall
            // if ActionsUI was the panel container

            var panelContainer = new PanelContainer()
            {
                StyleClasses        = { StyleNano.StyleClassHotbarPanel },
                SizeFlagsHorizontal = SizeFlags.None,
                SizeFlagsVertical   = SizeFlags.None
            };

            AddChild(panelContainer);

            var hotbarContainer = new VBoxContainer
            {
                SeparationOverride  = 3,
                SizeFlagsHorizontal = SizeFlags.None
            };

            panelContainer.AddChild(hotbarContainer);

            var settingsContainer = new HBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand
            };

            hotbarContainer.AddChild(settingsContainer);

            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });
            _lockTexture   = resourceCache.GetTexture("/Textures/Interface/Nano/lock.svg.192dpi.png");
            _unlockTexture = resourceCache.GetTexture("/Textures/Interface/Nano/lock_open.svg.192dpi.png");
            _lockButton    = new TextureButton
            {
                TextureNormal         = _unlockTexture,
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                Scale = (0.5f, 0.5f)
            };
            settingsContainer.AddChild(_lockButton);
            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            _settingsButton = new TextureButton
            {
                TextureNormal         = resourceCache.GetTexture("/Textures/Interface/Nano/gear.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                Scale = (0.5f, 0.5f)
            };
            settingsContainer.AddChild(_settingsButton);
            settingsContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });

            // this allows a 2 column layout if window gets too small
            _slotContainer = new GridContainer
            {
                MaxHeight = CalcMaxHeight()
            };
            hotbarContainer.AddChild(_slotContainer);

            _loadoutContainer = new HBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                MouseFilter         = MouseFilterMode.Stop
            };
            hotbarContainer.AddChild(_loadoutContainer);

            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });
            var previousHotbarIcon = new TextureRect()
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/left_arrow.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(previousHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            _loadoutNumber = new Label
            {
                Text = "1",
                SizeFlagsStretchRatio = 1
            };
            _loadoutContainer.AddChild(_loadoutNumber);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2
            });
            var nextHotbarIcon = new TextureRect
            {
                Texture               = resourceCache.GetTexture("/Textures/Interface/Nano/right_arrow.svg.192dpi.png"),
                SizeFlagsHorizontal   = SizeFlags.ShrinkCenter,
                SizeFlagsVertical     = SizeFlags.ShrinkCenter,
                SizeFlagsStretchRatio = 1,
                TextureScale          = (0.5f, 0.5f)
            };

            _loadoutContainer.AddChild(nextHotbarIcon);
            _loadoutContainer.AddChild(new Control {
                SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1
            });

            _slots = new ActionSlot[ClientActionsComponent.Slots];

            _dragShadow = new TextureRect
            {
                CustomMinimumSize = (64, 64),
                Stretch           = TextureRect.StretchMode.Scale,
                Visible           = false
            };
            UserInterfaceManager.PopupRoot.AddChild(_dragShadow);
            LayoutContainer.SetSize(_dragShadow, (64, 64));

            for (byte i = 0; i < ClientActionsComponent.Slots; i++)
            {
                var slot = new ActionSlot(this, _menu, actionsComponent, i);
                _slotContainer.AddChild(slot);
                _slots[i] = slot;
            }

            DragDropHelper = new DragDropHelper <ActionSlot>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);
        }
        public CargoConsoleMenu(CargoConsoleBoundUserInterface owner)
        {
            IoCManager.InjectDependencies(this);
            Owner = owner;

            if (Owner.RequestOnly)
            {
                Title = _loc.GetString("Cargo Request Console");
            }
            else
            {
                Title = _loc.GetString("Cargo Shuttle Console");
            }

            var rows = new VBoxContainer();

            var accountName      = new HBoxContainer();
            var accountNameLabel = new Label {
                Text         = _loc.GetString("Account Name: "),
                StyleClasses = { NanoStyle.StyleClassLabelKeyText }
            };

            _accountNameLabel = new Label {
                Text = "None" //Owner.Bank.Account.Name
            };
            accountName.AddChild(accountNameLabel);
            accountName.AddChild(_accountNameLabel);
            rows.AddChild(accountName);

            var points      = new HBoxContainer();
            var pointsLabel = new Label
            {
                Text         = _loc.GetString("Points: "),
                StyleClasses = { NanoStyle.StyleClassLabelKeyText }
            };

            _pointsLabel = new Label
            {
                Text = "0" //Owner.Bank.Account.Balance.ToString()
            };
            points.AddChild(pointsLabel);
            points.AddChild(_pointsLabel);
            rows.AddChild(points);

            var shuttleStatus      = new HBoxContainer();
            var shuttleStatusLabel = new Label
            {
                Text         = _loc.GetString("Shuttle Status: "),
                StyleClasses = { NanoStyle.StyleClassLabelKeyText }
            };

            _shuttleStatusLabel = new Label
            {
                Text = _loc.GetString("Away") // Shuttle.Status
            };
            shuttleStatus.AddChild(shuttleStatusLabel);
            shuttleStatus.AddChild(_shuttleStatusLabel);
            rows.AddChild(shuttleStatus);

            var buttons = new HBoxContainer();

            CallShuttleButton = new Button()
            {
                Text                = _loc.GetString("Call Shuttle"),
                TextAlign           = Button.AlignMode.Center,
                SizeFlagsHorizontal = SizeFlags.FillExpand
            };
            PermissionsButton = new Button()
            {
                Text      = _loc.GetString("Permissions"),
                TextAlign = Button.AlignMode.Center
            };
            buttons.AddChild(CallShuttleButton);
            buttons.AddChild(PermissionsButton);
            rows.AddChild(buttons);

            var category = new HBoxContainer();

            _categories = new OptionButton
            {
                Prefix = _loc.GetString("Categories: "),
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };
            _searchBar = new LineEdit
            {
                PlaceHolder           = _loc.GetString("Search"),
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };
            category.AddChild(_categories);
            category.AddChild(_searchBar);
            rows.AddChild(category);

            var products = new ScrollContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 6
            };

            Products = new VBoxContainer()
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand
            };
            products.AddChild(Products);
            rows.AddChild(products);

            var requestsAndOrders = new PanelContainer
            {
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 6,
                PanelOverride         = new StyleBoxFlat {
                    BackgroundColor = Color.Black
                }
            };
            var orderScrollBox = new ScrollContainer
            {
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            var rAndOVBox     = new VBoxContainer();
            var requestsLabel = new Label {
                Text = _loc.GetString("Requests")
            };

            _requests = new VBoxContainer // replace with scroll box so that approval buttons can be added
            {
                StyleClasses          = { "transparentItemList" },
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };
            var ordersLabel = new Label {
                Text = _loc.GetString("Orders")
            };

            _orders = new VBoxContainer
            {
                StyleClasses          = { "transparentItemList" },
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };
            rAndOVBox.AddChild(requestsLabel);
            rAndOVBox.AddChild(_requests);
            rAndOVBox.AddChild(ordersLabel);
            rAndOVBox.AddChild(_orders);
            orderScrollBox.AddChild(rAndOVBox);
            requestsAndOrders.AddChild(orderScrollBox);
            rows.AddChild(requestsAndOrders);

            rows.AddChild(new TextureButton
            {
                SizeFlagsVertical = SizeFlags.FillExpand,
            });
            Contents.AddChild(rows);

            CallShuttleButton.OnPressed += OnCallShuttleButtonPressed;
            _searchBar.OnTextChanged    += OnSearchBarTextChanged;
            _categories.OnItemSelected  += OnCategoryItemSelected;
        }
示例#20
0
            public ApcWindow()
            {
                Title = "APC";
                var rows = new VBoxContainer("Rows");

                var statusHeader = new Label("StatusHeader")
                {
                    Text = "Power Status: "
                };

                rows.AddChild(statusHeader);

                var breaker      = new HBoxContainer("Breaker");
                var breakerLabel = new Label("Label")
                {
                    Text = "Main Breaker: "
                };

                BreakerButton = new CheckButton {
                    Name = "Breaker", Text = "Toggle"
                };
                breaker.AddChild(breakerLabel);
                breaker.AddChild(BreakerButton);
                rows.AddChild(breaker);

                var externalStatus      = new HBoxContainer("ExternalStatus");
                var externalStatusLabel = new Label("Label")
                {
                    Text = "External Power: "
                };

                ExternalPowerStateLabel = new Label("Status")
                {
                    Text = "Good"
                };
                ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
                externalStatus.AddChild(externalStatusLabel);
                externalStatus.AddChild(ExternalPowerStateLabel);
                rows.AddChild(externalStatus);

                var charge      = new HBoxContainer("Charge");
                var chargeLabel = new Label("Label")
                {
                    Text = "Charge:"
                };

                ChargeBar = new ProgressBar("Charge")
                {
                    SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
                    MinValue            = 0.0f,
                    MaxValue            = 1.0f,
                    Page  = 0.0f,
                    Value = 0.5f
                };
                ChargePercentage = new Label("ChargePercentage");
                charge.AddChild(chargeLabel);
                charge.AddChild(ChargeBar);
                charge.AddChild(ChargePercentage);
                rows.AddChild(charge);

                Contents.AddChild(rows);
            }
示例#21
0
        public readonly Button MachineLinkingButton; // Enables/disables machine linking mode.

        public SandboxWindow()
        {
            Resizable = false;

            Title = "Sandbox Panel";

            var vBox = new VBoxContainer {
                SeparationOverride = 4
            };

            Contents.AddChild(vBox);

            RespawnButton = new Button {
                Text = Loc.GetString("Respawn")
            };
            vBox.AddChild(RespawnButton);

            SpawnEntitiesButton = new Button {
                Text = Loc.GetString("Spawn Entities")
            };
            vBox.AddChild(SpawnEntitiesButton);

            SpawnTilesButton = new Button {
                Text = Loc.GetString("Spawn Tiles")
            };
            vBox.AddChild(SpawnTilesButton);

            GiveFullAccessButton = new Button {
                Text = Loc.GetString("Grant Full Access")
            };
            vBox.AddChild(GiveFullAccessButton);

            GiveAghostButton = new Button {
                Text = Loc.GetString("Ghost")
            };
            vBox.AddChild(GiveAghostButton);

            ToggleLightButton = new Button {
                Text = Loc.GetString("Toggle Lights"), ToggleMode = true
            };
            vBox.AddChild(ToggleLightButton);

            ToggleFovButton = new Button {
                Text = Loc.GetString("Toggle FOV"), ToggleMode = true
            };
            vBox.AddChild(ToggleFovButton);

            ToggleShadowsButton = new Button {
                Text = Loc.GetString("Toggle Shadows"), ToggleMode = true
            };
            vBox.AddChild(ToggleShadowsButton);

            ToggleSubfloorButton = new Button {
                Text = Loc.GetString("Toggle Subfloor"), ToggleMode = true
            };
            vBox.AddChild(ToggleSubfloorButton);

            SuicideButton = new Button {
                Text = Loc.GetString("Suicide")
            };
            vBox.AddChild(SuicideButton);

            ShowMarkersButton = new Button {
                Text = Loc.GetString("Show Spawns"), ToggleMode = true
            };
            vBox.AddChild(ShowMarkersButton);

            ShowBbButton = new Button {
                Text = Loc.GetString("Show Bb"), ToggleMode = true
            };
            vBox.AddChild(ShowBbButton);

            MachineLinkingButton = new Button {
                Text = Loc.GetString("Link machines"), ToggleMode = true
            };
            vBox.AddChild(MachineLinkingButton);
        }
示例#22
0
        public ChatBox()
        {
            /*MarginLeft = -475.0f;
             * MarginTop = 10.0f;
             * MarginRight = -10.0f;
             * MarginBottom = 235.0f;
             *
             * AnchorLeft = 1.0f;
             * AnchorRight = 1.0f;*/
            MouseFilter = MouseFilterMode.Stop;

            var outerVBox = new VBoxContainer();

            var panelContainer = new PanelContainer
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = Color.FromHex("#25252aaa")
                },
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            var vBox = new VBoxContainer();

            panelContainer.AddChild(vBox);
            var hBox = new HBoxContainer();

            outerVBox.AddChild(panelContainer);
            outerVBox.AddChild(hBox);


            var contentMargin = new MarginContainer
            {
                MarginLeftOverride = 4, MarginRightOverride = 4,
                SizeFlagsVertical  = SizeFlags.FillExpand
            };

            Contents = new OutputPanel();
            contentMargin.AddChild(Contents);
            vBox.AddChild(contentMargin);

            Input = new HistoryLineEdit();
            Input.OnKeyBindDown += InputKeyBindDown;
            Input.OnTextEntered += Input_OnTextEntered;
            vBox.AddChild(Input);

            AllButton = new Button
            {
                Text = Loc.GetString("All"),
                Name = "ALL",
                SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand,
                ToggleMode          = true,
            };

            LocalButton = new Button
            {
                Text       = Loc.GetString("Local"),
                Name       = "Local",
                ToggleMode = true,
            };

            OOCButton = new Button
            {
                Text       = Loc.GetString("OOC"),
                Name       = "OOC",
                ToggleMode = true,
            };

            AdminButton = new Button
            {
                Text       = Loc.GetString("Admin"),
                Name       = "Admin",
                ToggleMode = true,
                Visible    = false
            };

            AllButton.OnToggled   += OnFilterToggled;
            LocalButton.OnToggled += OnFilterToggled;
            OOCButton.OnToggled   += OnFilterToggled;
            AdminButton.OnToggled += OnFilterToggled;

            hBox.AddChild(AllButton);
            hBox.AddChild(LocalButton);
            hBox.AddChild(OOCButton);
            hBox.AddChild(AdminButton);

            AddChild(outerVBox);
        }
示例#23
0
        public LatheMenu(LatheBoundUserInterface owner = null)
        {
            IoCManager.InjectDependencies(this);

            Owner = owner;

            Title = "Lathe Menu";

            var margin = new MarginContainer()
            {
                SizeFlagsVertical   = SizeFlags.FillExpand,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
            };

            var vBox = new VBoxContainer()
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 5,
            };

            var hBoxButtons = new HBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };

            QueueButton = new Button()
            {
                Text                  = "Queue",
                TextAlign             = Label.AlignMode.Center,
                SizeFlagsHorizontal   = SizeFlags.Fill,
                SizeFlagsStretchRatio = 1,
            };

            ServerConnectButton = new Button()
            {
                Text                  = "Server list",
                TextAlign             = Label.AlignMode.Center,
                SizeFlagsHorizontal   = SizeFlags.Fill,
                SizeFlagsStretchRatio = 1,
            };

            ServerSyncButton = new Button()
            {
                Text                  = "Sync",
                TextAlign             = Label.AlignMode.Center,
                SizeFlagsHorizontal   = SizeFlags.Fill,
                SizeFlagsStretchRatio = 1,
            };

            var spacer = new Control()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 3,
            };

            var hBoxFilter = new HBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };

            _searchBar = new LineEdit()
            {
                PlaceHolder           = "Search Designs",
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 3
            };

            _searchBar.OnTextChanged += Populate;

            var filterButton = new Button()
            {
                Text                  = "Filter",
                TextAlign             = Label.AlignMode.Center,
                SizeFlagsHorizontal   = SizeFlags.Fill,
                SizeFlagsStretchRatio = 1,
                Disabled              = true,
            };

            _items = new ItemList()
            {
                SizeFlagsStretchRatio = 8,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SelectMode            = ItemList.ItemListSelectMode.Button,
            };

            _items.OnItemSelected += ItemSelected;

            _amountLineEdit = new LineEdit()
            {
                PlaceHolder         = "Amount",
                Text                = "1",
                SizeFlagsHorizontal = SizeFlags.FillExpand,
            };

            _amountLineEdit.OnTextChanged += PopulateDisabled;

            _materials = new ItemList()
            {
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 3
            };

            hBoxButtons.AddChild(spacer);
            if (Owner?.Database is ProtolatheDatabaseComponent database)
            {
                hBoxButtons.AddChild(ServerConnectButton);
                hBoxButtons.AddChild(ServerSyncButton);
                database.OnDatabaseUpdated += Populate;
            }
            hBoxButtons.AddChild(QueueButton);

            hBoxFilter.AddChild(_searchBar);
            hBoxFilter.AddChild(filterButton);

            vBox.AddChild(hBoxButtons);
            vBox.AddChild(hBoxFilter);
            vBox.AddChild(_items);
            vBox.AddChild(_amountLineEdit);
            vBox.AddChild(_materials);

            margin.AddChild(vBox);

            Contents.AddChild(margin);
        }
示例#24
0
        public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache)
        {
            var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = new Color(37, 37, 42),
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            var panel = new Panel
            {
                PanelOverride = back
            };

            AddChild(panel);

            panel.SetAnchorAndMarginPreset(LayoutPreset.Wide);

            var vBox = new VBoxContainer {
                SeparationOverride = 0
            };

            vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);

            vBox.MarginTop = 40;

            AddChild(vBox);

            AddChild(new Label
            {
                Text         = localization.GetString("Lobby"),
                StyleClasses = { NanoStyle.StyleClassLabelHeadingBigger },
                MarginBottom = 40,
                MarginLeft   = 8,
                VAlign       = Label.VAlignMode.Center
            });

            AddChild(ServerName = new Label
            {
                StyleClasses   = { NanoStyle.StyleClassLabelHeadingBigger },
                MarginBottom   = 40,
                GrowHorizontal = GrowDirection.Both,
                VAlign         = Label.VAlignMode.Center
            });

            ServerName.SetAnchorAndMarginPreset(LayoutPreset.CenterTop);

            AddChild(LeaveButton = new Button
            {
                SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
                Text           = localization.GetString("Leave"),
                StyleClasses   = { NanoStyle.StyleClassButtonBig },
                GrowHorizontal = GrowDirection.Begin
            });

            LeaveButton.SetAnchorAndMarginPreset(LayoutPreset.TopRight);

            vBox.AddChild(new Panel
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = NanoStyle.NanoGold,
                    ContentMarginTopOverride = 2
                },
            });

            var hBox = new HBoxContainer
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            hBox.AddChild(new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SeparationOverride  = 0,
                Children            =
                {
                    new Placeholder(resourceCache)
                    {
                        SizeFlagsVertical = SizeFlags.FillExpand,
                        PlaceholderText   = localization.GetString("Character UI\nPlaceholder")
                    },

                    new StripeBack
                    {
                        Children =
                        {
                            new MarginContainer
                            {
                                MarginRightOverride  = 3,
                                MarginLeftOverride   = 3,
                                MarginTopOverride    = 3,
                                MarginBottomOverride = 3,
                                Children             =
                                {
                                    new HBoxContainer
                                    {
                                        SeparationOverride = 6,
                                        Children           =
                                        {
                                            (ObserveButton          = new Button
                                            {
                                                Text                = localization.GetString("Observe"),
                                                StyleClasses        = { NanoStyle.StyleClassButtonBig }
                                            }),
                                            (StartTime              = new Label
                                            {
                                                SizeFlagsHorizontal = SizeFlags.FillExpand,
                                                Align               = Label.AlignMode.Right,
                                                FontColorOverride   = Color.DarkGray,
                                                StyleClasses        = { NanoStyle.StyleClassLabelBig  }
                                            }),
                                            (ReadyButton            = new Button
                                            {
                                                ToggleMode          = true,
                                                Text                = localization.GetString("Ready Up"),
                                                StyleClasses        = { NanoStyle.StyleClassButtonBig }
                                            }),
                                        }
                                    }
                                }
                            }
                        }
                    },

                    new MarginContainer
                    {
                        MarginRightOverride  = 3,
                        MarginLeftOverride   = 3,
                        MarginTopOverride    = 3,
                        MarginBottomOverride = 3,
                        SizeFlagsVertical    = SizeFlags.FillExpand,
                        Children             =
                        {
                            (Chat     = new ChatBox
                            {
                                Input =     { PlaceHolder = localization.GetString("Say something!")}
                            })
                        }
                    },
                }
            });

            hBox.AddChild(new Panel
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = NanoStyle.NanoGold
                }, CustomMinimumSize = (2, 0)
            });
示例#25
0
        public CharacterSetupGui(
            IEntityManager entityManager,
            IResourceCache resourceCache,
            IClientPreferencesManager preferencesManager,
            IPrototypeManager prototypeManager)
        {
            AddChild(new ParallaxControl());

            _entityManager      = entityManager;
            _preferencesManager = preferencesManager;
            var margin = new Control
            {
                Margin = new Thickness(20),
            };

            AddChild(margin);

            var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = new Color(37, 37, 42)
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            var panel = new PanelContainer
            {
                PanelOverride = back
            };

            margin.AddChild(panel);

            var vBox = new VBoxContainer {
                SeparationOverride = 0
            };

            margin.AddChild(vBox);

            var topHBox = new HBoxContainer
            {
                MinSize  = (0, 40),
                Children =
                {
                    new Label
                    {
                        Margin       = new Thickness(8, 0, 0, 0),
                        Text         = Loc.GetString("character-setup-gui-character-setup-label"),
                        StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger                    },
                        VAlign       = Label.VAlignMode.Center,
                    },
                    (SaveButton = new Button
                    {
                        HorizontalExpand = true,
                        HorizontalAlignment = HAlignment.Right,
                        Text = Loc.GetString("character-setup-gui-character-setup-save-button"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                    }),
                    (CloseButton = new Button
                    {
                        Text = Loc.GetString("character-setup-gui-character-setup-close-button"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                    })
                }
            };

            vBox.AddChild(topHBox);

            vBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = StyleNano.NanoGold,
                    ContentMarginTopOverride = 2
                }
            });

            var hBox = new HBoxContainer
            {
                VerticalExpand     = true,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            _charactersVBox = new VBoxContainer();

            hBox.AddChild(new ScrollContainer
            {
                MinSize  = (325, 0),
                Margin   = new Thickness(5, 5, 0, 0),
                Children =
                {
                    _charactersVBox
                }
            });
示例#26
0
    private void WriteOrganelleProcessList(List <ProcessSpeedInformation> processList,
                                           VBoxContainer targetElement)
    {
        // Remove previous process list
        if (targetElement.GetChildCount() > 0)
        {
            foreach (Node children in targetElement.GetChildren())
            {
                children.QueueFree();
            }
        }

        if (processList == null)
        {
            var noProcesslabel = new Label();
            noProcesslabel.Text = "No processes";
            targetElement.AddChild(noProcesslabel);
            return;
        }

        foreach (var process in processList)
        {
            var processContainer = new VBoxContainer();
            targetElement.AddChild(processContainer);

            var processTitle = new Label();
            processTitle.AddColorOverride("font_color", new Color(1.0f, 0.84f, 0.0f));
            processTitle.Text = process.Process.Name;
            processContainer.AddChild(processTitle);

            var processBody = new HBoxContainer();

            bool usePlus;

            if (process.OtherInputs.Count == 0)
            {
                // Just environmental stuff
                usePlus = true;
            }
            else
            {
                // Something turns into something else, uses the arrow notation
                usePlus = false;

                // Show the inputs
                // TODO: add commas or maybe pluses for multiple inputs
                foreach (var key in process.OtherInputs.Keys)
                {
                    var inputCompound = process.OtherInputs[key];

                    var amountLabel = new Label();
                    amountLabel.Text = Math.Round(inputCompound.Amount, 3) + " ";
                    processBody.AddChild(amountLabel);
                    processBody.AddChild(GUICommon.Instance.CreateCompoundIcon(inputCompound.Compound.Name));
                }

                // And the arrow
                var arrow = new TextureRect();
                arrow.Expand      = true;
                arrow.RectMinSize = new Vector2(20, 20);
                arrow.Texture     = GD.Load <Texture>("res://assets/textures/gui/bevel/WhiteArrow.png");
                processBody.AddChild(arrow);
            }

            // Outputs of the process. It's assumed that every process has outputs
            foreach (var key in process.Outputs.Keys)
            {
                var outputCompound = process.Outputs[key];

                var amountLabel = new Label();

                var stringBuilder = new StringBuilder(string.Empty, 150);

                // Changes process title and process# to red if process has 0 output
                if (outputCompound.Amount == 0)
                {
                    processTitle.AddColorOverride("font_color", new Color(1.0f, 0.1f, 0.1f));
                    amountLabel.AddColorOverride("font_color", new Color(1.0f, 0.1f, 0.1f));
                }

                if (usePlus)
                {
                    stringBuilder.Append(outputCompound.Amount >= 0 ? "+" : string.Empty);
                }

                stringBuilder.Append(Math.Round(outputCompound.Amount, 3) + " ");

                amountLabel.Text = stringBuilder.ToString();

                processBody.AddChild(amountLabel);
                processBody.AddChild(GUICommon.Instance.CreateCompoundIcon(outputCompound.Compound.Name));
            }

            var perSecondLabel = new Label();
            perSecondLabel.Text = "/second";

            processBody.AddChild(perSecondLabel);

            // Environment conditions
            if (process.EnvironmentInputs.Count > 0)
            {
                var atSymbol = new Label();

                atSymbol.Text        = "@";
                atSymbol.RectMinSize = new Vector2(30, 20);
                atSymbol.Align       = Label.AlignEnum.Center;
                processBody.AddChild(atSymbol);

                var first = true;

                foreach (var key in process.EnvironmentInputs.Keys)
                {
                    if (!first)
                    {
                        var commaLabel = new Label();
                        commaLabel.Text = ", ";
                        processBody.AddChild(commaLabel);
                    }

                    first = false;

                    var environmentCompound = process.EnvironmentInputs[key];

                    // To percentage
                    var percentageLabel = new Label();

                    // TODO: sunlight needs some special handling (it used to say the lux amount)
                    percentageLabel.Text = Math.Round(environmentCompound.AvailableAmount * 100, 1) + "%";

                    processBody.AddChild(percentageLabel);
                    processBody.AddChild(GUICommon.Instance.CreateCompoundIcon(environmentCompound.Compound.Name));
                }
            }

            processContainer.AddChild(processBody);
        }
    }
示例#27
0
        public async void DoExamine(IEntity entity)
        {
            CloseTooltip();

            var popupPos = _inputManager.MouseScreenPosition;



            // Actually open the tooltip.
            _examineTooltipOpen = new Popup();
            _userInterfaceManager.StateRoot.AddChild(_examineTooltipOpen);
            var panel = new PanelContainer();

            panel.AddStyleClass(StyleClassEntityTooltip);
            panel.ModulateSelfOverride = Color.LightGray.WithAlpha(0.90f);
            _examineTooltipOpen.AddChild(panel);
            //panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
            var vBox = new VBoxContainer();

            panel.AddChild(vBox);
            var hBox = new HBoxContainer {
                SeparationOverride = 5
            };

            vBox.AddChild(hBox);
            if (entity.TryGetComponent(out ISpriteComponent sprite))
            {
                hBox.AddChild(new SpriteView {
                    Sprite = sprite
                });
            }

            hBox.AddChild(new Label
            {
                Text = entity.Name,
                SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
            });

            const float minWidth = 300;
            var         size     = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);

            popupPos += Vector2.ComponentMin(Vector2.Zero, _userInterfaceManager.StateRoot.Size - (size + popupPos));

            _examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));

            if (entity.Uid.IsClientSide())
            {
                return;
            }

            // Ask server for extra examine info.
            RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity.Uid));

            ExamineSystemMessages.ExamineInfoResponseMessage response;
            try
            {
                _requestCancelTokenSource = new CancellationTokenSource();
                response =
                    await AwaitNetMessage <ExamineSystemMessages.ExamineInfoResponseMessage>(_requestCancelTokenSource
                                                                                             .Token);
            }
            catch (TaskCanceledException)
            {
                return;
            }
            finally
            {
                _requestCancelTokenSource = null;
            }

            foreach (var msg in response.Message.Tags.OfType <FormattedMessage.TagText>())
            {
                if (!string.IsNullOrWhiteSpace(msg.Text))
                {
                    var richLabel = new RichTextLabel();
                    richLabel.SetMessage(response.Message);
                    vBox.AddChild(richLabel);
                    break;
                }
            }

            //_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position));
        }
示例#28
0
        protected override void Initialize()
        {
            base.Initialize();

            Title = "Entity Spawn Panel";

            HSplitContainer = new HSplitContainer
            {
                Name        = "HSplitContainer",
                MouseFilter = MouseFilterMode.Pass
            };

            // Left side
            var prototypeListScroll = new ScrollContainer("PrototypeListScrollContainer")
            {
                CustomMinimumSize   = new Vector2(200.0f, 0.0f),
                RectClipContent     = true,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                HScrollEnabled      = true,
                VScrollEnabled      = true
            };

            PrototypeList = new VBoxContainer("PrototypeList")
            {
                MouseFilter         = MouseFilterMode.Ignore,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SeparationOverride  = new int?(2),
                Align = BoxContainer.AlignMode.Begin
            };
            prototypeListScroll.AddChild(PrototypeList);
            HSplitContainer.AddChild(prototypeListScroll);

            // Right side
            var options = new VBoxContainer("Options")
            {
                CustomMinimumSize = new Vector2(200.0f, 0.0f), MouseFilter = MouseFilterMode.Ignore
            };

            SearchBar = new LineEdit("SearchBar")
            {
                MouseFilter = MouseFilterMode.Stop, PlaceHolder = "Search Entities"
            };
            SearchBar.OnTextChanged += OnSearchBarTextChanged;
            options.AddChild(SearchBar);

            var buttons = new HBoxContainer("Buttons!")
            {
                MouseFilter = MouseFilterMode.Ignore
            };

            ClearButton = new Button("ClearButton")
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                Disabled            = true,
                ToggleMode          = false,
                Text = "Clear Search",
            };
            ClearButton.OnPressed += OnClearButtonPressed;
            EraseButton            = new Button("EraseButton")
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                ToggleMode          = true,
                Text = "Erase Mode"
            };
            EraseButton.OnToggled += OnEraseButtonToggled;
            buttons.AddChild(ClearButton);
            buttons.AddChild(EraseButton);
            options.AddChild(buttons);

            var overridePlacementText = new Label("OverridePlacementText")
            {
                MouseFilter       = MouseFilterMode.Ignore,
                SizeFlagsVertical = SizeFlags.ShrinkCenter,
                Text = "Override Placement:"
            };

            OverrideMenu = new OptionButton("OverrideMenu")
            {
                ToggleMode = false
            };                                                                   //, TextAlign = Button.AlignMode.Left};
            OverrideMenu.OnItemSelected += OnOverrideMenuItemSelected;
            for (var i = 0; i < initOpts.Length; i++)
            {
                OverrideMenu.AddItem(initOpts[i], i);
            }

            options.AddChild(overridePlacementText);
            options.AddChild(OverrideMenu);
            HSplitContainer.AddChild(options);
            Contents.AddChild(HSplitContainer);

            Size = new Vector2(400.0f, 300.0f);
        }
示例#29
0
        public LobbyGui(IEntityManager entityManager,
                        IResourceCache resourceCache,
                        IClientPreferencesManager preferencesManager)
        {
            var margin = new MarginContainer
            {
                MarginBottomOverride = 20,
                MarginLeftOverride   = 20,
                MarginRightOverride  = 20,
                MarginTopOverride    = 20,
            };

            AddChild(margin);

            var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
            var back     = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = new Color(37, 37, 42),
            };

            back.SetPatchMargin(StyleBox.Margin.All, 10);

            var panel = new PanelContainer
            {
                PanelOverride = back
            };

            margin.AddChild(panel);

            var vBox = new VBoxContainer {
                SeparationOverride = 0
            };

            margin.AddChild(vBox);

            var topHBox = new HBoxContainer
            {
                CustomMinimumSize = (0, 40),
                Children          =
                {
                    new MarginContainer
                    {
                        MarginLeftOverride = 8,
                        Children           =
                        {
                            new Label
                            {
                                Text         = Loc.GetString("Lobby"),
                                StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger                    },

                                /*MarginBottom = 40,
                                 * MarginLeft = 8,*/
                                VAlign = Label.VAlignMode.Center
                            }
                        }
                    },
                    (ServerName = new Label
                    {
                        StyleClasses ={ StyleNano.StyleClassLabelHeadingBigger                    },

                        /*MarginBottom = 40,
                         * GrowHorizontal = GrowDirection.Both,*/
                        VAlign = Label.VAlignMode.Center,
                        SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
                    }),
                    (CreditsButton = new Button
                    {
                        SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
                        Text = Loc.GetString("Credits"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                        //GrowHorizontal = GrowDirection.Begin
                    }),
                    (LeaveButton = new Button
                    {
                        SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
                        Text = Loc.GetString("Leave"),
                        StyleClasses ={ StyleNano.StyleClassButtonBig                             },
                        //GrowHorizontal = GrowDirection.Begin
                    })
                }
            };

            vBox.AddChild(topHBox);

            vBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat
                {
                    BackgroundColor          = StyleNano.NanoGold,
                    ContentMarginTopOverride = 2
                },
            });

            var hBox = new HBoxContainer
            {
                SizeFlagsVertical  = SizeFlags.FillExpand,
                SeparationOverride = 0
            };

            vBox.AddChild(hBox);

            CharacterPreview = new LobbyCharacterPreviewPanel(
                entityManager,
                preferencesManager)
            {
                SizeFlagsHorizontal = SizeFlags.None
            };
            hBox.AddChild(new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SeparationOverride  = 0,
                Children            =
                {
                    CharacterPreview,

                    new StripeBack
                    {
                        Children =
                        {
                            new MarginContainer
                            {
                                MarginRightOverride  = 3,
                                MarginLeftOverride   = 3,
                                MarginTopOverride    = 3,
                                MarginBottomOverride = 3,
                                Children             =
                                {
                                    new HBoxContainer
                                    {
                                        SeparationOverride = 6,
                                        Children           =
                                        {
                                            (ObserveButton          = new Button
                                            {
                                                Text                = Loc.GetString("Observe"),
                                                StyleClasses        = { StyleNano.StyleClassButtonBig }
                                            }),
                                            (StartTime              = new Label
                                            {
                                                SizeFlagsHorizontal = SizeFlags.FillExpand,
                                                Align               = Label.AlignMode.Right,
                                                FontColorOverride   = Color.DarkGray,
                                                StyleClasses        = { StyleNano.StyleClassLabelBig  }
                                            }),
                                            (ReadyButton            = new Button
                                            {
                                                ToggleMode          = true,
                                                Text                = Loc.GetString("Ready Up"),
                                                StyleClasses        = { StyleNano.StyleClassButtonBig }
                                            }),
                                        }
                                    }
                                }
                            }
                        }
                    },

                    new MarginContainer
                    {
                        MarginRightOverride  = 3,
                        MarginLeftOverride   = 3,
                        MarginTopOverride    = 3,
                        MarginBottomOverride = 3,
                        SizeFlagsVertical    = SizeFlags.FillExpand,
                        Children             =
                        {
                            (Chat     = new ChatBox
                            {
                                Input = { PlaceHolder = Loc.GetString("Say something!") }
                            })
                        }
                    },
                }
            });

            hBox.AddChild(new PanelContainer
            {
                PanelOverride = new StyleBoxFlat {
                    BackgroundColor = StyleNano.NanoGold
                }, CustomMinimumSize = (2, 0)
            });
示例#30
0
    /// <summary>
    ///   Updates the mouse hover box with stuff.
    /// </summary>
    /// <remarks>
    ///   <para>
    ///     This creates and removes GUI elements every frame.
    ///     Supposedly that's quite expensive, but I think that's
    ///     how the old JS code do it anyway.
    ///   </para>
    /// </remarks>
    private void UpdateHoverInfo()
    {
        foreach (Node children in hoveredItems.GetChildren())
        {
            hoveredItems.RemoveChild(children);

            // Using QueueFree leaves a gap at
            // the bottom of the panel
            children.Free();
        }

        if (mouseHoverPanel.RectSize != new Vector2(270, 130))
        {
            mouseHoverPanel.RectSize = new Vector2(270, 130);
        }

        if (mouseHoverPanel.MarginLeft != -280)
        {
            mouseHoverPanel.MarginLeft = -280;
        }
        if (mouseHoverPanel.MarginRight != -10)
        {
            mouseHoverPanel.MarginRight = -10;
        }

        var compounds = stage.Clouds.GetAllAvailableAt(stage.Camera.CursorWorldPos);

        var builder = new StringBuilder(string.Empty, 250);

        if (showMouseCoordinates)
        {
            builder.AppendFormat(CultureInfo.CurrentCulture, "Stuff at {0:F1}, {1:F1}:\n",
                                 stage.Camera.CursorWorldPos.x, stage.Camera.CursorWorldPos.z);
        }

        var mousePosLabel = hoveredItems.GetParent().GetNode <Label>("MousePos");

        if (compounds.Count == 0)
        {
            builder.Append("Nothing to eat here");
        }
        else
        {
            builder.Append("At cursor:");

            bool first = true;

            // Create for each compound the information in GUI
            foreach (var entry in compounds)
            {
                if (first)
                {
                    var compoundsLabel = new Label();
                    compoundsLabel.Valign = Label.VAlign.Center;
                    hoveredItems.AddChild(compoundsLabel);
                    compoundsLabel.AddConstantOverride("line_spacing", -5);
                    compoundsLabel.Text = "Compounds: \n";
                }

                first = false;

                var hBox         = new HBoxContainer();
                var compoundText = new Label();

                var readableName = entry.Key.Name;
                var compoundIcon = GUICommon.Instance.CreateCompoundIcon(readableName, 25, 25);

                var compoundsText = new StringBuilder(readableName, 150);
                compoundsText.AppendFormat(CultureInfo.CurrentCulture, ": {0:F1}", entry.Value);

                compoundText.Text = compoundsText.ToString();

                hBox.AddChild(compoundIcon);
                hBox.AddChild(compoundText);
                hoveredItems.AddChild(hBox);
            }
        }

        var aiMicrobes = GetTree().GetNodesInGroup(Constants.AI_GROUP);

        // Show the hovered over microbe's species
        foreach (Microbe entry in aiMicrobes)
        {
            var distance = (entry.Translation - stage.Camera.CursorWorldPos).Length();

            // Find only cells that have the mouse
            // position within their membrane
            if (distance > entry.Radius)
            {
                continue;
            }

            var microbeText = new Label();
            microbeText.Valign = Label.VAlign.Center;
            hoveredItems.AddChild(microbeText);

            microbeText.Text = "Cell of species " + entry.Species.FormattedName;
        }

        mousePosLabel.Text = builder.ToString();
    }