public InstrumentMenu(InstrumentBoundUserInterface owner) { IoCManager.InjectDependencies(this); Title = "Instrument"; _owner = owner; _owner.Instrument.OnMidiPlaybackEnded += InstrumentOnMidiPlaybackEnded; var margin = new MarginContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hBoxTopButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Align = BoxContainer.AlignMode.Center }; midiInputButton = new Button() { Text = "MIDI Input", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, ToggleMode = true, Pressed = _owner.Instrument.IsInputOpen, }; midiInputButton.OnToggled += MidiInputButtonOnOnToggled; var topSpacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var midiFileButton = new Button() { Text = "Open File", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; midiFileButton.OnPressed += MidiFileButtonOnOnPressed; var hBoxBottomButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Align = BoxContainer.AlignMode.Center }; midiLoopButton = new Button() { Text = "Loop", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, ToggleMode = true, Disabled = !_owner.Instrument.IsMidiOpen, Pressed = _owner.Instrument.LoopMidi, }; midiLoopButton.OnToggled += MidiLoopButtonOnOnToggled; var bottomSpacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; midiStopButton = new Button() { Text = "Stop", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Disabled = !_owner.Instrument.IsMidiOpen, }; midiStopButton.OnPressed += MidiStopButtonOnPressed; hBoxBottomButtons.AddChild(midiLoopButton); hBoxBottomButtons.AddChild(bottomSpacer); hBoxBottomButtons.AddChild(midiStopButton); hBoxTopButtons.AddChild(midiInputButton); hBoxTopButtons.AddChild(topSpacer); hBoxTopButtons.AddChild(midiFileButton); vBox.AddChild(hBoxTopButtons); vBox.AddChild(hBoxBottomButtons); margin.AddChild(vBox); Contents.AddChild(margin); }
public async void DoExamine(IEntity entity) { const float minWidth = 300; CloseTooltip(); var popupPos = _userInterfaceManager.MousePositionScaled; // Actually open the tooltip. _examineTooltipOpen = new Popup { MaxWidth = 400 }; _userInterfaceManager.ModalRoot.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, OverrideDirection = Direction.South }); } hBox.AddChild(new Label { Text = entity.Name, HorizontalExpand = true, }); panel.Measure(Vector2.Infinity); var size = Vector2.ComponentMax((minWidth, 0), panel.DesiredSize); _examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos.Position, size)); FormattedMessage message; if (entity.Uid.IsClientSide()) { message = GetExamineText(entity, _playerManager.LocalPlayer?.ControlledEntity); } else { // Ask server for extra examine info. RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity.Uid)); ExamineSystemMessages.ExamineInfoResponseMessage response; try { _requestCancelTokenSource = new CancellationTokenSource(); response = await AwaitNetworkEvent <ExamineSystemMessages.ExamineInfoResponseMessage>(_requestCancelTokenSource .Token); } catch (TaskCanceledException) { return; } finally { _requestCancelTokenSource = null; } message = response.Message; } foreach (var msg in message.Tags.OfType <FormattedMessage.TagText>()) { if (!string.IsNullOrWhiteSpace(msg.Text)) { var richLabel = new RichTextLabel(); richLabel.SetMessage(message); vBox.AddChild(richLabel); break; } } }
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); MonoBottomPanel = new MonoBottomPanel(); bottomPanelBtn = AddControlToBottomPanel(MonoBottomPanel, "Mono"); // TTR("Mono") 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", (int)MenuOptions.AboutCSharp); // TTR("About C# support") 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) * Internal.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 and Windows, but not yet to mobile or web platforms. " + "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!"; Internal.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)) { // Defer this task because EditorProgress calls Main::iterarion() and the main loop is not yet initialized. CallDeferred(nameof(_MakeApiSolutionsIfNeeded)); // Make sure the existing project has Api assembly references configured correctly CSharpProject.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath); } else { bottomPanelBtn.Hide(); menuPopup.AddItem("Create C# solution", (int)MenuOptions.CreateSln); // TTR("Create C# solution") } 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 Internal.EditorDef("mono/editor/external_editor", ExternalEditor.None); string settingsHintStr = "Disabled"; if (OS.IsWindows()) { settingsHintStr += $",MonoDevelop:{(int) ExternalEditor.MonoDevelop}" + $",Visual Studio Code:{(int) ExternalEditor.VsCode}"; } else if (OS.IsOSX()) { settingsHintStr += $",Visual Studio:{(int) ExternalEditor.VisualStudioForMac}" + $",MonoDevelop:{(int) ExternalEditor.MonoDevelop}" + $",Visual Studio Code:{(int) ExternalEditor.VsCode}"; } else if (OS.IsUnix()) { settingsHintStr += $",MonoDevelop:{(int) ExternalEditor.MonoDevelop}" + $",Visual Studio Code:{(int) ExternalEditor.VsCode}"; } 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 GodotSharpExport(); AddExportPlugin(exportPlugin); exportPluginWeak = new WeakReference <GodotSharpExport>(exportPlugin); GodotSharpBuilds.Initialize(); }
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.PressedSignal += BuildProjectPressed; toolBarHBox.AddChild(buildProjectBtn); toolBarHBox.AddSpacer(begin: false); warningsBtn = new ToolButton { Text = "Warnings".TTR(), ToggleMode = true, Pressed = true, Visible = false, FocusMode = FocusModeEnum.None }; warningsBtn.Toggled += _WarningsToggled; toolBarHBox.AddChild(warningsBtn); errorsBtn = new ToolButton { Text = "Errors".TTR(), ToggleMode = true, Pressed = true, Visible = false, FocusMode = FocusModeEnum.None }; errorsBtn.Toggled += _ErrorsToggled; toolBarHBox.AddChild(errorsBtn); toolBarHBox.AddSpacer(begin: false); viewLogBtn = new Button { Text = "View log".TTR(), FocusMode = FocusModeEnum.None, Visible = false }; viewLogBtn.PressedSignal += _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.ItemSelected += _BuildTabsItemSelected; buildTabsList.NothingSelected += _BuildTabsNothingSelected; hsc.AddChild(buildTabsList); buildTabs = new TabContainer { TabAlign = TabContainer.TabAlignEnum.Left, SizeFlagsHorizontal = (int)SizeFlags.ExpandFill, TabsVisible = false }; hsc.AddChild(buildTabs); } }
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.Toggled += enabled => { bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start"); if (showOnStart != enabled) { editorSettings.SetSetting("mono/editor/show_info_on_start", enabled); } }; aboutVBox.AddChild(aboutDialogCheckBox); } if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath)) { try { // Migrate solution from old configuration names to: Debug, ExportDebug and ExportRelease DotNetSolution.MigrateFromOldConfigNames(GodotSharpDirs.ProjectSlnPath); // Migrate csproj from old configuration names to: Debug, ExportDebug and ExportRelease ProjectUtils.MigrateFromOldConfigNames(GodotSharpDirs.ProjectCsProjPath); // Apply the other fixes after configurations are migrated // Make sure the existing project has Api assembly references configured correctly ProjectUtils.FixApiHintPath(GodotSharpDirs.ProjectCsProjPath); } catch (Exception e) { GD.PushError(e.ToString()); } } else { bottomPanelBtn.Hide(); menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln); } menuPopup.IdPressed += _MenuOptionPressed; var buildButton = new ToolButton { Text = "Build", HintTooltip = "Build solution", FocusMode = Control.FocusModeEnum.None }; buildButton.PressedSignal += _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); }
public StorageWindow() { Title = "Storage Item"; RectClipContent = true; var containerButton = new ContainerButton { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.Fill, MouseFilter = MouseFilterMode.Pass, }; var innerContainerButton = new PanelContainer { PanelOverride = _unHoveredBox, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.Fill, }; containerButton.AddChild(innerContainerButton); containerButton.OnPressed += args => { var controlledEntity = IoCManager.Resolve <IPlayerManager>().LocalPlayer.ControlledEntity; if (controlledEntity.TryGetComponent(out HandsComponent hands)) { StorageEntity.SendNetworkMessage(new InsertEntityMessage()); } }; VSplitContainer = new VBoxContainer() { MouseFilter = MouseFilterMode.Ignore, }; containerButton.AddChild(VSplitContainer); Information = new Label { Text = "Items: 0 Volume: 0/0 Stuff", SizeFlagsVertical = SizeFlags.ShrinkCenter }; VSplitContainer.AddChild(Information); var listScrollContainer = new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, HScrollEnabled = true, VScrollEnabled = true, }; EntityList = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; listScrollContainer.AddChild(EntityList); VSplitContainer.AddChild(listScrollContainer); Contents.AddChild(containerButton); listScrollContainer.OnMouseEntered += args => { innerContainerButton.PanelOverride = _HoveredBox; }; listScrollContainer.OnMouseExited += args => { innerContainerButton.PanelOverride = _unHoveredBox; }; }
public CharacterSetupGui(IEntityManager entityManager, 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("/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); CloseButton = new Button { SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd, Text = Loc.GetString("Save and close"), StyleClasses = { StyleNano.StyleClassButtonBig } }; var topHBox = new HBoxContainer { CustomMinimumSize = (0, 40), Children = { new MarginContainer { MarginLeftOverride = 8, Children = { new Label { Text = Loc.GetString("Character Setup"), StyleClasses = { StyleNano.StyleClassLabelHeadingBigger }, VAlign = Label.VAlignMode.Center, SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter } } }, CloseButton } }; 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); _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 } } } });
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, ILocalizationManager localizationManager) { _localizationManager = localizationManager; _owner = owner; var vBox = new VBoxContainer(); { var hBox = new HBoxContainer(); vBox.AddChild(hBox); _privilegedIdButton = new Button(); _privilegedIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.PrivilegedId); hBox.AddChild(_privilegedIdButton); _targetIdButton = new Button(); _targetIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.TargetId); hBox.AddChild(_targetIdButton); } { var hBox = new HBoxContainer(); vBox.AddChild(hBox); hBox.AddChild(_fullNameLabel = new Label() { Text = localizationManager.GetString("Full name:") }); _fullNameLineEdit = new LineEdit() { SizeFlagsHorizontal = SizeFlags.FillExpand, }; hBox.AddChild(_fullNameLineEdit); } { var hBox = new HBoxContainer(); vBox.AddChild(hBox); hBox.AddChild(_jobTitleLabel = new Label() { Text = localizationManager.GetString("Job title:") }); _jobTitleLineEdit = new LineEdit() { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBox.AddChild(_jobTitleLineEdit); } { var hBox = new HBoxContainer(); vBox.AddChild(hBox); foreach (var accessName in SharedAccess.AllAccess) { var newButton = new Button() { Text = accessName, ToggleMode = true, }; hBox.AddChild(newButton); _accessButtons.Add(accessName, newButton); } } { var hBox = new HBoxContainer(); vBox.AddChild(hBox); _submitButton = new Button() { Text = localizationManager.GetString("Submit") }; _submitButton.OnPressed += _ => owner.SubmitData( _fullNameLineEdit.Text, _jobTitleLineEdit.Text, // Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair _accessButtons.Where(x => x.Value.Pressed).Select(x => x.Key).ToList()); hBox.AddChild(_submitButton); } Contents.AddChild(vBox); }
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 { CustomMinimumSize = (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 MarginContainer { MarginLeftOverride = 4, MarginTopOverride = 2, MarginRightOverride = 12, MarginBottomOverride = 2, Children = { new HBoxContainer { Children = { (_lblName = new Label { Text = Loc.GetString("Gas Tank"), FontOverride = font, FontColorOverride = StyleNano.NanoGold, SizeFlagsVertical = SizeFlags.ShrinkCenter }), new Control { CustomMinimumSize = (20, 0), SizeFlagsHorizontal = SizeFlags.Expand },
public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache) { PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(37, 37, 45) }; PanelOverride.SetContentMarginOverride(StyleBox.Margin.All, 4); var vBox = new VBoxContainer(); AddChild(vBox); { // Title bar. var titleContainer = new HBoxContainer(); vBox.AddChild(titleContainer); var lobbyTitle = new Label { Text = localization.GetString("Lobby"), SizeFlagsHorizontal = SizeFlags.None }; lobbyTitle.AddStyleClass(NanoStyle.StyleClassLabelHeading); titleContainer.AddChild(lobbyTitle); titleContainer.AddChild(ServerName = new Label { SizeFlagsHorizontal = SizeFlags.ShrinkCenter | SizeFlags.Expand }); ServerName.AddStyleClass(NanoStyle.StyleClassLabelHeading); titleContainer.AddChild(LeaveButton = new Button { SizeFlagsHorizontal = SizeFlags.ShrinkEnd, Text = localization.GetString("Leave") }); LeaveButton.AddStyleClass(NanoStyle.StyleClassButtonBig); } var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; vBox.AddChild(hBox); { var leftVBox = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBox.AddChild(leftVBox); leftVBox.AddChild(new Placeholder(resourceCache) { SizeFlagsVertical = SizeFlags.FillExpand, PlaceholderText = localization.GetString("Character UI\nPlaceholder") }); var readyButtons = new HBoxContainer(); leftVBox.AddChild(readyButtons); readyButtons.AddChild(ObserveButton = new Button { Text = localization.GetString("Observe") }); ObserveButton.AddStyleClass(NanoStyle.StyleClassButtonBig); readyButtons.AddChild(StartTime = new Label { SizeFlagsHorizontal = SizeFlags.FillExpand, Align = Label.AlignMode.Right }); readyButtons.AddChild(ReadyButton = new Button { ToggleMode = true, Text = localization.GetString("Ready Up") }); ReadyButton.AddStyleClass(NanoStyle.StyleClassButtonBig); leftVBox.AddChild(Chat = new ChatBox { SizeFlagsVertical = SizeFlags.FillExpand }); Chat.Input.PlaceHolder = localization.GetString("Talk!"); } { var rightVBox = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBox.AddChild(rightVBox); rightVBox.AddChild(new Label { Text = localization.GetString("Online Players:") }); rightVBox.AddChild(OnlinePlayerItemList = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand, //SelectMode = ItemList.ItemListSelectMode.None }); rightVBox.AddChild(new Placeholder(resourceCache) { SizeFlagsVertical = SizeFlags.FillExpand, PlaceholderText = localization.GetString("Server Info\nPlaceholder") }); } }
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 = { StyleNano.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 = { StyleNano.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 = { StyleNano.StyleClassLabelKeyText } }; _shuttleStatusLabel = new Label { Text = Loc.GetString("Away") // Shuttle.Status }; shuttleStatus.AddChild(shuttleStatusLabel); shuttleStatus.AddChild(_shuttleStatusLabel); rows.AddChild(shuttleStatus); var shuttleCapacity = new HBoxContainer(); var shuttleCapacityLabel = new Label { Text = Loc.GetString("Order Capacity: "), StyleClasses = { StyleNano.StyleClassLabelKeyText } }; _shuttleCapacityLabel = new Label { Text = "0/20" }; shuttleCapacity.AddChild(shuttleCapacityLabel); shuttleCapacity.AddChild(_shuttleCapacityLabel); rows.AddChild(shuttleCapacity); var buttons = new HBoxContainer(); CallShuttleButton = new Button() { Text = Loc.GetString("Call Shuttle"), TextAlign = Label.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand }; PermissionsButton = new Button() { Text = Loc.GetString("Permissions"), TextAlign = Label.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; }
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; }
private async void PopulateChangelog() { // Changelog is not kept in memory so load it again. var changelog = await _changelog.LoadChangelog(); var byDay = changelog .GroupBy(e => e.Time.ToLocalTime().Date) .OrderByDescending(c => c.Key); var hasRead = _changelog.MaxId <= _changelog.LastReadId; foreach (var dayEntries in byDay) { var day = dayEntries.Key; var groupedEntries = dayEntries .GroupBy(c => (c.Author, Read: c.Id <= _changelog.LastReadId)) .OrderBy(c => c.Key.Read) .ThenBy(c => c.Key.Author); string dayNice; var today = DateTime.Today; if (day == today) { dayNice = Loc.GetString("changelog-today"); } else if (day == today.AddDays(-1)) { dayNice = Loc.GetString("changelog-yesterday"); } else { dayNice = day.ToShortDateString(); } ChangelogBody.AddChild(new Label { Text = dayNice, StyleClasses = { "LabelHeading" }, Margin = new Thickness(4, 6, 0, 0) }); var first = true; foreach (var groupedEntry in groupedEntries) { var(author, read) = groupedEntry.Key; if (!first) { ChangelogBody.AddChild(new Control { Margin = new Thickness(4) }); } if (read && !hasRead) { hasRead = true; var upArrow = _resourceCache.GetTexture("/Textures/Interface/Changelog/up_arrow.svg.192dpi.png"); var readDivider = new VBoxContainer(); var hBox = new HBoxContainer { HorizontalAlignment = HAlignment.Center, Children = { new TextureRect { Texture = upArrow, ModulateSelfOverride = Color.FromHex("#888"), TextureScale = (0.5f, 0.5f), Margin = new Thickness(4, 3), VerticalAlignment = VAlignment.Bottom },
// Called when the node enters the scene tree for the first time. public override void _Ready() { globale = (Global)GetNode("/root/Global"); // bt_s_game = (Button)GetNode("Menu_Buttons/HScrollBar/Bt_game"); bt_s_graphics = (Button)GetNode("Menu_Buttons/HScrollBar/Bt_graphics"); bt_s_audio = (Button)GetNode("Menu_Buttons/HScrollBar/Bt_audio"); bt_s_other = (Button)GetNode("Menu_Buttons/HScrollBar/Bt_other"); cb_showfps = (CheckBox)GetNode("Settings/VBoxContainer/St_showfps/Cb_showfps"); te_width = (TextEdit)GetNode("Settings/VBoxContainer/St_dwidth/te_width"); te_height = (TextEdit)GetNode("Settings/VBoxContainer/St_dheight/te_height"); // popup = (PopupDialog)GetNode("PopupDialog"); vscrollbare = (VScrollBar)GetNode("VScrollBar"); vboxcontainere = (VBoxContainer)GetNode("Settings/VBoxContainer"); //Initialisation des Layout settings //fps cb_showfps.Pressed = globale.aff_fps; //resolution te_width.Text = "" + ProjectSettings.GetSetting("display/window/size/width"); te_height.Text = "" + ProjectSettings.GetSetting("display/window/size/height"); //vsync CheckBox cb_vsync = (CheckBox)GetNode("Settings/VBoxContainer/St_vsync/Cb"); cb_vsync.Pressed = (Boolean)ProjectSettings.GetSetting("display/window/vsync/use_vsync"); //3d effects CheckBox cb_3de = (CheckBox)GetNode("Settings/VBoxContainer/St_3d_effects/Cb"); int fba; if (globale.is_mobile()) { fba = (int)ProjectSettings.GetSetting("rendering/quality/intended_usage/framebuffer_allocation.mobile"); } else { fba = (int)ProjectSettings.GetSetting("rendering/quality/intended_usage/framebuffer_allocation"); } cb_3de.Pressed = fba == 2; //hdr CheckBox cb_hdr = (CheckBox)GetNode("Settings/VBoxContainer/St_hdr/Cb"); if (globale.is_mobile()) { cb_hdr.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/depth/hdr.mobile"); } else { cb_hdr.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/depth/hdr"); } //anisotropic HScrollBar hsb_anis = (HScrollBar)GetNode("Settings/VBoxContainer/St_anisotropic/HScrollBar"); hsb_anis.MaxValue = anisotropics.Length; int aniv = (int)ProjectSettings.GetSetting("rendering/quality/filters/anisotropic_filter_level"); if (anisotropics.Contains(aniv)) { hsb_anis.Value = Array.IndexOf(anisotropics, aniv); } else { hsb_anis.Value = 0; ProjectSettings.SetSetting("rendering/quality/filters/anisotropic_filter_level", anisotropics[0]); } on_anis_change((float)hsb_anis.Value); //High quality ggx CheckBox cb_ggx = (CheckBox)GetNode("Settings/VBoxContainer/St_high_quality_ggx/Cb"); if (globale.is_mobile()) { cb_ggx.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/reflections/high_quality_ggx.mobile"); } else { cb_ggx.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/reflections/high_quality_ggx"); } //Reflex Atlas Size HScrollBar hsb_ras = (HScrollBar)GetNode("Settings/VBoxContainer/St_reflex_atlas_size/HScrollBar"); hsb_ras.MaxValue = atlas_sizes.Length; int rasv = (int)ProjectSettings.GetSetting("rendering/quality/reflections/atlas_size"); if (atlas_sizes.Contains(rasv)) { hsb_ras.Value = Array.IndexOf(atlas_sizes, rasv); } else { hsb_ras.Value = 0; ProjectSettings.SetSetting("rendering/quality/reflections/atlas_size", atlas_sizes[0]); } on_ras_change((float)hsb_ras.Value); //texture array reflexion CheckBox cb_tar = (CheckBox)GetNode("Settings/VBoxContainer/St_high_quality_ggx/Cb"); if (globale.is_mobile()) { cb_tar.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/reflections/texture_array_reflections.mobile"); } else { cb_tar.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/reflections/texture_array_reflections"); } //Force vertex Shading CheckBox cb_fvs = (CheckBox)GetNode("Settings/VBoxContainer/St_force_vertex_shading/Cb"); if (globale.is_mobile()) { cb_fvs.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/shading/force_vertex_shading.mobile"); } else { cb_fvs.Pressed = (Boolean)ProjectSettings.GetSetting("rendering/quality/shading/force_vertex_shading"); } //Shadow Atlas size HScrollBar hsb_sas = (HScrollBar)GetNode("Settings/VBoxContainer/St_shadow_atlas_size/HScrollBar"); hsb_sas.MaxValue = atlas_sizes.Length; string path_sas = "rendering/quality/shadow_atlas/size"; if (globale.is_mobile()) { path_sas = "rendering/quality/shadow_atlas/size.mobile"; } int sasv = (int)ProjectSettings.GetSetting(path_sas); if (atlas_sizes.Contains(sasv)) { hsb_sas.Value = Array.IndexOf(atlas_sizes, sasv); } else { hsb_sas.Value = 0; ProjectSettings.SetSetting(path_sas, atlas_sizes[0]); } on_sas_change((float)hsb_sas.Value); //Subsurface scattering HScrollBar hsb_ssc = (HScrollBar)GetNode("Settings/VBoxContainer/St_subsurface_scattering/HScrollBar"); hsb_ssc.MaxValue = 3; hsb_ssc.Value = (int)ProjectSettings.GetSetting("rendering/quality/subsurface_scattering/quality"); on_ssc_change((float)hsb_ssc.Value); //Ambient occlusion HScrollBar hsb_sao = (HScrollBar)GetNode("Settings/VBoxContainer/St_ambient_occlusion/HScrollBar"); hsb_sao.MaxValue = saos.Length; if (globale.sao == true) { hsb_sao.Value = 0; } else { hsb_sao.Value = globale.sao_quality + 1; } on_sao_change((float)hsb_sao.Value); //Glow Strength HScrollBar hsb_gs = (HScrollBar)GetNode("Settings/VBoxContainer/St_glow_strength/HScrollBar"); hsb_gs.Value = globale.glow_strength; on_glow_s_change((float)hsb_gs.Value); //Glow Intensity HScrollBar hsb_gi = (HScrollBar)GetNode("Settings/VBoxContainer/St_glow_intensity/HScrollBar"); hsb_gi.Value = globale.glow_intensity; on_glow_i_change((float)hsb_gi.Value); //Saturation HScrollBar hsb_sat = (HScrollBar)GetNode("Settings/VBoxContainer/St_Saturation/HScrollBar"); hsb_sat.Value = globale.saturation; on_saturation_change((float)hsb_sat.Value); //Brightness HScrollBar hsb_lum = (HScrollBar)GetNode("Settings/VBoxContainer/St_Brightness/HScrollBar"); hsb_lum.Value = globale.luminosity; on_brightness_change((float)hsb_lum.Value); //Far HScrollBar hsb_far = (HScrollBar)GetNode("Settings/VBoxContainer/St_fov/HScrollBar"); hsb_far.Value = globale.cam_far; on_far_change((float)hsb_far.Value); // at_start = false; }
public ChatBox() { MarginLeft = -475.0f; MarginTop = 10.0f; MarginRight = -10.0f; MarginBottom = 235.0f; AnchorLeft = 1.0f; AnchorRight = 1.0f; 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 LineEdit(); Input.OnKeyDown += InputKeyDown; Input.OnTextEntered += Input_OnTextEntered; vBox.AddChild(Input); AllButton = new Button { Text = localize.GetString("All"), Name = "ALL", SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand, ToggleMode = true, }; LocalButton = new Button { Text = localize.GetString("Local"), Name = "Local", ToggleMode = true, }; OOCButton = new Button { Text = localize.GetString("OOC"), Name = "OOC", ToggleMode = true, }; AllButton.OnToggled += OnFilterToggled; LocalButton.OnToggled += OnFilterToggled; OOCButton.OnToggled += OnFilterToggled; hBox.AddChild(AllButton); hBox.AddChild(LocalButton); hBox.AddChild(OOCButton); AddChild(outerVBox); }
public override void Initialize(SS14Window window, object obj) { _entity = (IEntity)obj; var scrollContainer = new ScrollContainer(); //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true); window.Contents.AddChild(scrollContainer); var vBoxContainer = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, }; scrollContainer.AddChild(vBoxContainer); // Handle top bar displaying type and ToString(). { Control top; var stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified); if (typeStringified != "") { //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10); // Custom ToString() implementation. var headBox = new VBoxContainer { SeparationOverride = 0 }; headBox.AddChild(new Label { Text = stringified, ClipText = true }); headBox.AddChild(new Label { Text = typeStringified, // FontOverride = smallFont, FontColorOverride = Color.DarkGray, ClipText = true }); top = headBox; } else { top = new Label { Text = stringified }; } if (_entity.TryGetComponent(out ISpriteComponent? sprite)) { var hBox = new HBoxContainer(); top.SizeFlagsHorizontal = SizeFlags.FillExpand; hBox.AddChild(top); hBox.AddChild(new SpriteView { Sprite = sprite }); vBoxContainer.AddChild(hBox); } else { vBoxContainer.AddChild(top); } } _tabs = new TabContainer(); _tabs.OnTabChanged += _tabsOnTabChanged; vBoxContainer.AddChild(_tabs); var clientVBox = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(clientVBox); _tabs.SetTabTitle(TabClientVars, "Client Variables"); var first = true; foreach (var group in LocalPropertyList(obj, ViewVariablesManager, _robustSerializer)) { ViewVariablesTraitMembers.CreateMemberGroupHeader( ref first, TypeAbbreviation.Abbreviate(group.Key), clientVBox); foreach (var control in group) { clientVBox.AddChild(control); } } _clientComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_clientComponents); _tabs.SetTabTitle(TabClientComponents, "Client Components"); PopulateClientComponents(); if (!_entity.Uid.IsClientSide()) { _serverVariables = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverVariables); _tabs.SetTabTitle(TabServerVars, "Server Variables"); _serverComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverComponents); _tabs.SetTabTitle(TabServerComponents, "Server Components"); PopulateServerComponents(false); } }
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("/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 }), (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) });
public TutorialWindow() { Title = "The Tutorial!"; //Get section header font var cache = IoCManager.Resolve <IResourceCache>(); var inputManager = IoCManager.Resolve <IInputManager>(); Font headerFont = new VectorFont(cache.GetResource <FontResource>("/Nano/NotoSans/NotoSans-Regular.ttf"), _headerFontSize); var scrollContainer = new ScrollContainer(); scrollContainer.AddChild(VBox = new VBoxContainer()); Contents.AddChild(scrollContainer); //Intro VBox.AddChild(new Label { FontOverride = headerFont, Text = "Intro" }); AddFormattedText(IntroContents); string Key(BoundKeyFunction func) { return(FormattedMessage.EscapeText(inputManager.GetKeyFunctionButtonString(func))); } //Controls VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nControls" }); // Moved this down here so that Rider shows which args correspond to which format spot. AddFormattedText(Loc.GetString(@"Movement: [color=#a4885c]{0} {1} {2} {3}[/color] Switch hands: [color=#a4885c]{4}[/color] Use held item: [color=#a4885c]{5}[/color] Drop held item: [color=#a4885c]{6}[/color] Open inventory: [color=#a4885c]{7}[/color] Open character window: [color=#a4885c]{8}[/color] Open crafting window: [color=#a4885c]{9}[/color] Focus chat: [color=#a4885c]{10}[/color] Use targeted entity: [color=#a4885c]{11}[/color] Throw held item: [color=#a4885c]{12}[/color] Examine entity: [color=#a4885c]{13}[/color] Open entity context menu: [color=#a4885c]{14}[/color] Toggle combat mode: [color=#a4885c]{15}[/color] Toggle console: [color=#a4885c]{16}[/color] Toggle UI: [color=#a4885c]{17}[/color] Toggle debug overlay: [color=#a4885c]{18}[/color] Toggle entity spawner: [color=#a4885c]{19}[/color] Toggle tile spawner: [color=#a4885c]{20}[/color] Toggle sandbox window: [color=#a4885c]{21}[/color]", Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight), Key(SwapHands), Key(ActivateItemInHand), Key(Drop), Key(OpenInventoryMenu), Key(OpenCharacterMenu), Key(OpenCraftingMenu), Key(FocusChat), Key(ActivateItemInWorld), Key(ThrowItemInHand), Key(ExamineEntity), Key(OpenContextMenu), Key(ToggleCombatMode), Key(ShowDebugConsole), Key(HideUI), Key(ShowDebugMonitors), Key(OpenEntitySpawnWindow), Key(OpenTileSpawnWindow), Key(OpenSandboxWindow))); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = Loc.GetString("\nSandbox spawner", Key(OpenSandboxWindow)) }); AddFormattedText(SandboxSpawnerContents); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" }); AddFormattedText(GameplayContents); //Feedback VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nFeedback" }); AddFormattedText(FeedbackContents); }
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, }; var groupController = IoCManager.Resolve <IClientConGroupController>(); if (groupController.CanCommand("asay")) { AdminButton = new Button { Text = Loc.GetString("Admin"), Name = "Admin", ToggleMode = true, }; } AllButton.OnToggled += OnFilterToggled; LocalButton.OnToggled += OnFilterToggled; OOCButton.OnToggled += OnFilterToggled; hBox.AddChild(AllButton); hBox.AddChild(LocalButton); hBox.AddChild(OOCButton); if (AdminButton != null) { AdminButton.OnToggled += OnFilterToggled; hBox.AddChild(AdminButton); } AddChild(outerVBox); }
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(); var usePlus = true; 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); } }
public TutorialWindow() { MinSize = SetSize = (520, 580); Title = "The Tutorial!"; //Get section header font var cache = IoCManager.Resolve <IResourceCache>(); var inputManager = IoCManager.Resolve <IInputManager>(); Font headerFont = new VectorFont(cache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), _headerFontSize); var scrollContainer = new ScrollContainer(); scrollContainer.AddChild(VBox = new VBoxContainer()); Contents.AddChild(scrollContainer); //Intro VBox.AddChild(new Label { FontOverride = headerFont, Text = "Intro" }); AddFormattedText(IntroContents); string Key(BoundKeyFunction func) { return(FormattedMessage.EscapeText(inputManager.GetKeyFunctionButtonString(func))); } //Controls VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nControls" }); // Moved this down here so that Rider shows which args correspond to which format spot. AddFormattedText(Loc.GetString(@"Movement: [color=#a4885c]{0} {1} {2} {3}[/color] Switch hands: [color=#a4885c]{4}[/color] Use held item: [color=#a4885c]{5}[/color] Drop held item: [color=#a4885c]{6}[/color] Smart equip from backpack: [color=#a4885c]{24}[/color] Smart equip from belt: [color=#a4885c]{25}[/color] Open inventory: [color=#a4885c]{7}[/color] Open character window: [color=#a4885c]{8}[/color] Open crafting window: [color=#a4885c]{9}[/color] Open action menu: [color=#a4885c]{33}[/color] Focus chat: [color=#a4885c]{10}[/color] Focus OOC: [color=#a4885c]{26}[/color] Focus Admin Chat: [color=#a4885c]{27}[/color] Use hand/object in hand: [color=#a4885c]{22}[/color] Do wide attack: [color=#a4885c]{23}[/color] Use targeted entity: [color=#a4885c]{11}[/color] Throw held item: [color=#a4885c]{12}[/color] Pull entity: [color=#a4885c]{30}[/color] Move pulled entity: [color=#a4885c]{29}[/color] Stop pulling: [color=#a4885c]{32}[/color] Examine entity: [color=#a4885c]{13}[/color] Point somewhere: [color=#a4885c]{28}[/color] Open entity context menu: [color=#a4885c]{14}[/color] Toggle combat mode: [color=#a4885c]{15}[/color] Toggle console: [color=#a4885c]{16}[/color] Toggle UI: [color=#a4885c]{17}[/color] Toggle debug overlay: [color=#a4885c]{18}[/color] Toggle entity spawner: [color=#a4885c]{19}[/color] Toggle tile spawner: [color=#a4885c]{20}[/color] Toggle sandbox window: [color=#a4885c]{21}[/color] Toggle admin menu [color=#a4885c]{31}[/color] Hotbar slot 1: [color=#a4885c]{34}[/color] Hotbar slot 2: [color=#a4885c]{35}[/color] Hotbar slot 3: [color=#a4885c]{36}[/color] Hotbar slot 4: [color=#a4885c]{37}[/color] Hotbar slot 5: [color=#a4885c]{38}[/color] Hotbar slot 6: [color=#a4885c]{39}[/color] Hotbar slot 7: [color=#a4885c]{40}[/color] Hotbar slot 8: [color=#a4885c]{41}[/color] Hotbar slot 9: [color=#a4885c]{42}[/color] Hotbar slot 0: [color=#a4885c]{43}[/color] Hotbar Loadout 1: [color=#a4885c]{44}[/color] Hotbar Loadout 2: [color=#a4885c]{45}[/color] Hotbar Loadout 3: [color=#a4885c]{46}[/color] Hotbar Loadout 4: [color=#a4885c]{47}[/color] Hotbar Loadout 5: [color=#a4885c]{48}[/color] Hotbar Loadout 6: [color=#a4885c]{49}[/color] Hotbar Loadout 7: [color=#a4885c]{50}[/color] Hotbar Loadout 8: [color=#a4885c]{51}[/color] Hotbar Loadout 9: [color=#a4885c]{52}[/color] ", Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight), Key(SwapHands), Key(ActivateItemInHand), Key(Drop), Key(OpenInventoryMenu), Key(OpenCharacterMenu), Key(OpenCraftingMenu), Key(FocusChat), Key(ActivateItemInWorld), Key(ThrowItemInHand), Key(ExamineEntity), Key(OpenContextMenu), Key(ToggleCombatMode), Key(ShowDebugConsole), Key(HideUI), Key(ShowDebugMonitors), Key(OpenEntitySpawnWindow), Key(OpenTileSpawnWindow), Key(OpenSandboxWindow), Key(Use), Key(WideAttack), Key(SmartEquipBackpack), Key(SmartEquipBelt), Key(FocusOOC), Key(FocusAdminChat), Key(Point), Key(TryPullObject), Key(MovePulledObject), Key(OpenAdminMenu), Key(ReleasePulledObject), Key(OpenActionsMenu), Key(Hotbar1), Key(Hotbar2), Key(Hotbar3), Key(Hotbar4), Key(Hotbar5), Key(Hotbar6), Key(Hotbar7), Key(Hotbar8), Key(Hotbar9), Key(Hotbar0), Key(Loadout1), Key(Loadout2), Key(Loadout3), Key(Loadout4), Key(Loadout5), Key(Loadout6), Key(Loadout7), Key(Loadout8), Key(Loadout9))); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" }); AddFormattedText(GameplayContents); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = Loc.GetString("\nSandbox spawner", Key(OpenSandboxWindow)) }); AddFormattedText(SandboxSpawnerContents); //Feedback VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nFeedback" }); AddFormattedText(FeedbackContents); }
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); itemTooltipElements = GetTree().GetNodesInGroup("ItemTooltip"); loadingScreen = GetNode <LoadingScreen>("LoadingScreen"); menu = GetNode <Control>(MenuPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <TextureProgress>(MutationPointsBarPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionBar = GetNode <ProgressBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <ProgressBar>(ATPConsumptionBarPath); atpProductionLabel = GetNode <Label>(ATPProductionLabelPath); atpConsumptionLabel = GetNode <Label>(ATPConsumptionLabelPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesList = GetNode <VBoxContainer>(SpeciesListPath); physicalConditionsBox = GetNode <Control>(PhysicalConditionsBoxPath); atmosphericConditionsBox = GetNode <Control>(AtmosphericConditionsBoxPath); compoundsBox = GetNode <Control>(CompoundsBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); physicalConditionsButton = GetNode <Control>(PhysicalConditionsButtonPath); atmosphericConditionsButton = GetNode <Control>(AtmosphericConditionsButtonPath); compoundsButton = GetNode <Control>(CompoundsBoxButtonPath); speciesListButton = GetNode <Control>(SpeciesListButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); helpScreen = GetNode <HelpScreen>(HelpScreenPath); mapDrawer.OnSelectedPatchChanged = (drawer) => { UpdateShownPatchDetails(); }; // Fade out for that smooth satisfying transition TransitionManager.Instance.AddScreenFade(Fade.FadeType.FadeOut, 0.5f); TransitionManager.Instance.StartTransitions(null, string.Empty); }
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-window-label"), 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") } });
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(); }
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) });
public ActionsUI(ClientActionsComponent actionsComponent) { SetValue(LayoutContainer.DebugProperty, true); _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.Constrain); LayoutContainer.SetAnchorTop(this, 0f); LayoutContainer.SetAnchorBottom(this, 0.8f); LayoutContainer.SetMarginLeft(this, 13); LayoutContainer.SetMarginTop(this, 110); HorizontalAlignment = HAlignment.Left; VerticalExpand = true; 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 }, HorizontalAlignment = HAlignment.Left, VerticalAlignment = VAlignment.Top }; AddChild(panelContainer); var hotbarContainer = new VBoxContainer { SeparationOverride = 3, HorizontalAlignment = HAlignment.Left }; panelContainer.AddChild(hotbarContainer); var settingsContainer = new HBoxContainer { HorizontalExpand = true }; hotbarContainer.AddChild(settingsContainer); settingsContainer.AddChild(new Control { HorizontalExpand = true, 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, HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1, Scale = (0.5f, 0.5f) }; settingsContainer.AddChild(_lockButton); settingsContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 }); _settingsButton = new TextureButton { TextureNormal = resourceCache.GetTexture("/Textures/Interface/Nano/gear.svg.192dpi.png"), HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1, Scale = (0.5f, 0.5f) }; settingsContainer.AddChild(_settingsButton); settingsContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 }); // this allows a 2 column layout if window gets too small _slotContainer = new GridContainer { MaxGridHeight = CalcMaxHeight() }; hotbarContainer.AddChild(_slotContainer); _loadoutContainer = new HBoxContainer { HorizontalExpand = true, MouseFilter = MouseFilterMode.Stop }; hotbarContainer.AddChild(_loadoutContainer); _loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 }); var previousHotbarIcon = new TextureRect() { Texture = resourceCache.GetTexture("/Textures/Interface/Nano/left_arrow.svg.192dpi.png"), HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1, TextureScale = (0.5f, 0.5f) }; _loadoutContainer.AddChild(previousHotbarIcon); _loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 }); _loadoutNumber = new Label { Text = "1", SizeFlagsStretchRatio = 1 }; _loadoutContainer.AddChild(_loadoutNumber); _loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 }); var nextHotbarIcon = new TextureRect { Texture = resourceCache.GetTexture("/Textures/Interface/Nano/right_arrow.svg.192dpi.png"), HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1, TextureScale = (0.5f, 0.5f) }; _loadoutContainer.AddChild(nextHotbarIcon); _loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 }); _slots = new ActionSlot[ClientActionsComponent.Slots]; _dragShadow = new TextureRect { MinSize = (64, 64), Stretch = TextureRect.StretchMode.Scale, Visible = false, SetSize = (64, 64) }; UserInterfaceManager.PopupRoot.AddChild(_dragShadow); 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); MinSize = (10, 400); }
public override void Initialize(SS14Window window, object obj) { _entity = (IEntity)obj; var scrollContainer = new ScrollContainer(); //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true); window.Contents.AddChild(scrollContainer); var vBoxContainer = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, }; scrollContainer.AddChild(vBoxContainer); // Handle top bar displaying type and ToString(). { Control top; var stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified); if (typeStringified != "") { //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10); // Custom ToString() implementation. var headBox = new VBoxContainer { SeparationOverride = 0 }; headBox.AddChild(new Label { Text = stringified, ClipText = true }); headBox.AddChild(new Label { Text = typeStringified, // FontOverride = smallFont, FontColorOverride = Color.DarkGray, ClipText = true }); top = headBox; } else { top = new Label { Text = stringified }; } if (_entity.TryGetComponent(out ISpriteComponent? sprite)) { var hBox = new HBoxContainer(); top.SizeFlagsHorizontal = SizeFlags.FillExpand; hBox.AddChild(top); hBox.AddChild(new SpriteView { Sprite = sprite }); vBoxContainer.AddChild(hBox); } else { vBoxContainer.AddChild(top); } } _tabs = new TabContainer(); _tabs.OnTabChanged += _tabsOnTabChanged; vBoxContainer.AddChild(_tabs); var clientVBox = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(clientVBox); _tabs.SetTabTitle(TabClientVars, "Client Variables"); var first = true; foreach (var group in LocalPropertyList(obj, ViewVariablesManager, _resourceCache)) { ViewVariablesTraitMembers.CreateMemberGroupHeader( ref first, TypeAbbreviation.Abbreviate(group.Key), clientVBox); foreach (var control in group) { clientVBox.AddChild(control); } } _clientComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_clientComponents); _tabs.SetTabTitle(TabClientComponents, "Client Components"); _clientComponents.AddChild(_clientComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand }); _clientComponentsSearchBar.OnTextChanged += OnClientComponentsSearchBarChanged; // See engine#636 for why the Distinct() call. var componentList = _entity.GetAllComponents().OrderBy(c => c.GetType().ToString()); foreach (var component in componentList) { var button = new Button { Text = TypeAbbreviation.Abbreviate(component.GetType()), TextAlign = Label.AlignMode.Left }; button.OnPressed += args => { ViewVariablesManager.OpenVV(component); }; _clientComponents.AddChild(button); } if (!_entity.Uid.IsClientSide()) { _serverVariables = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverVariables); _tabs.SetTabTitle(TabServerVars, "Server Variables"); _serverComponents = new VBoxContainer { SeparationOverride = 0 }; _tabs.AddChild(_serverComponents); _tabs.SetTabTitle(TabServerComponents, "Server Components"); _serverComponents.AddChild(_serverComponentsSearchBar = new LineEdit { PlaceHolder = Loc.GetString("Search"), SizeFlagsHorizontal = SizeFlags.FillExpand }); _serverComponentsSearchBar.OnTextChanged += OnServerComponentsSearchBarChanged; } }
public void Execute(IConsoleShell shell, string argStr, string[] args) { var window = new SS14Window { CustomMinimumSize = (500, 400) }; var tabContainer = new TabContainer(); window.Contents.AddChild(tabContainer); var scroll = new ScrollContainer(); tabContainer.AddChild(scroll); //scroll.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide); var vBox = new VBoxContainer(); scroll.AddChild(vBox); var progressBar = new ProgressBar { MaxValue = 10, Value = 5 }; vBox.AddChild(progressBar); var optionButton = new OptionButton(); optionButton.AddItem("Honk"); optionButton.AddItem("Foo"); optionButton.AddItem("Bar"); optionButton.AddItem("Baz"); optionButton.OnItemSelected += eventArgs => optionButton.SelectId(eventArgs.Id); vBox.AddChild(optionButton); var tree = new Tree { SizeFlagsVertical = Control.SizeFlags.FillExpand }; var root = tree.CreateItem(); root.Text = "Honk!"; var child = tree.CreateItem(); child.Text = "Foo"; for (var i = 0; i < 20; i++) { child = tree.CreateItem(); child.Text = $"Bar {i}"; } vBox.AddChild(tree); var rich = new RichTextLabel(); var message = new FormattedMessage(); message.AddText("Foo\n"); message.PushColor(Color.Red); message.AddText("Bar"); message.Pop(); rich.SetMessage(message); vBox.AddChild(rich); var itemList = new ItemList(); tabContainer.AddChild(itemList); for (var i = 0; i < 10; i++) { itemList.AddItem(i.ToString()); } var grid = new GridContainer { Columns = 3 }; tabContainer.AddChild(grid); for (var y = 0; y < 3; y++) { for (var x = 0; x < 3; x++) { grid.AddChild(new Button { CustomMinimumSize = (50, 50), Text = $"{x}, {y}" });
// Called when the node enters the scene tree for the first time. public override void _Ready() { GenDetailScene = (PackedScene)ResourceLoader.Load("res://Godot/scenes/Gen6DoFJointControllerDetail.tscn"); HingeDetailScene = (PackedScene)ResourceLoader.Load("res://Godot/scenes/HingeJointControllerDetail.tscn"); jointList = (VBoxContainer)GetNode("Content/JointContainer/List"); }
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); AddressBox = new LineEdit { Text = "localhost", PlaceHolder = "server address:port", SizeFlagsHorizontal = SizeFlags.FillExpand }; vBox.AddChild(AddressBox); DirectConnectButton = new Button { Text = "Direct Connect", TextAlign = Button.AlignMode.Center }; vBox.AddChild(DirectConnectButton); OptionsButton = new Button { Text = "Options", TextAlign = Button.AlignMode.Center }; vBox.AddChild(OptionsButton); QuitButton = new Button { Text = "Quit", TextAlign = Button.AlignMode.Center }; vBox.AddChild(QuitButton); }