public SurgeryButton(int callbackData) { CallbackData = callbackData; Button = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(Button); var hBoxContainer = new HBoxContainer(); SpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f) }; DisplayText = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "N/A", }; hBoxContainer.AddChild(SpriteView); hBoxContainer.AddChild(DisplayText); EntityControl = new Control { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public void FillDataPipe(IEnumerable <IEnumerable <int> > data) { int numPipe = 0; foreach (IEnumerable <int> pipe in data) { HBoxContainer actualHBoxContainer = new HBoxContainer(); var actualLabelPipe = new Label(); numPipe++; actualLabelPipe.Text = $" * tube n°{numPipe}"; actualLabelPipe.AddFontOverride("font", ResourceLoader.Load <Font>("res://fonts/fontsmall.tres")); actualLabelPipe.AddColorOverride("font_color", Colors.Black); vBoxContainer.AddChild(actualLabelPipe); vBoxContainer.AddChild(actualHBoxContainer); var hSeparator = new HSeparator(); StyleBoxLine sbl = new StyleBoxLine() { Color = new Color("ad4c4c"), Thickness = 5 }; hSeparator.AddStyleboxOverride("separator", sbl); vBoxContainer.AddChild(hSeparator); foreach (int length in pipe) { actualHBoxContainer.AddChild(CreateLabelPipeDraw(length)); } } RectSize = new Vector2(RectSize.x, (numPipe) * 68); }
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null) { Owner = owner; Title = Loc.GetString("Microwave"); var hSplit = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.Fill }; IngredientsListReagents = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.Button, SizeFlagsStretchRatio = 2, CustomMinimumSize = (100, 128) }; IngredientsList = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.Button, SizeFlagsStretchRatio = 2, CustomMinimumSize = (100, 128) }; hSplit.AddChild(IngredientsListReagents); //Padding between the lists. hSplit.AddChild(new Control { CustomMinimumSize = (0, 5), });
public override void _Ready() { container = GetNode <HBoxContainer>("Container"); for (var i = 0; i < container.GetChildCount(); i++) { var cardPanel = container.GetChildren()[i] as Panel; var infoBox = cardPanel.GetNode <Panel>("Info").GetNode <VBoxContainer>("VBoxContainer"); // add 2 first children, which are usually Title & Description Interface.LabelGroup.Add(infoBox.GetChildren()[0] as Label); Interface.LabelGroup.Add(infoBox.GetChildren()[1] as Label); // add the animation player for this card panel Interface.CardsGroup.Add(cardPanel); var detector = cardPanel.GetNode <Panel>("Detector"); detectors.Add(detector); detector.Connect("mouse_entered", this, "_on_Detector_mouse_entered", new Array { i }); detector.Connect("mouse_exited", this, "_on_Detector_mouse_exited", new Array { i }); detector.Connect("gui_input", this, "_on_Detector_gui_input", new Array { i }); } }
public override void _Ready() { GetCommonNodes(); _marginContainer = _windowWrapper.GetNode <MarginContainer>("MarginContainer"); _horizontalContainer = _marginContainer.GetNode <HBoxContainer>("HorizontalContainer"); SetupView(); }
protected override Control MakeUI(object?value) { var hBox = new HBoxContainer { MinSize = new Vector2(200, 0) }; var angle = (Angle)value !; var lineEdit = new LineEdit { Text = angle.Degrees.ToString(CultureInfo.InvariantCulture), Editable = !ReadOnly, HorizontalExpand = true }; if (!ReadOnly) { lineEdit.OnTextEntered += e => ValueChanged(Angle.FromDegrees(double.Parse(e.Text, CultureInfo.InvariantCulture))); } hBox.AddChild(lineEdit); hBox.AddChild(new Label { Text = "deg" }); return(hBox); }
public void OpenPopup() { var popup = new AcceptDialog(); popup.SizeFlagsHorizontal = (int)Control.SizeFlags.ExpandFill; popup.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill; popup.PopupExclusive = true; popup.WindowTitle = "Configure snap"; var container = new VBoxContainer(); var snapSpin = new SpinBox(); snapSpin.MinValue = 0; snapSpin.MaxValue = 99; snapSpin.Step = 0.0001f; snapSpin.Value = snapLength; snapSpin.Connect("value_changed", this, "SetSnapLength"); var snapHBox = new HBoxContainer(); var snapLabel = new Label(); snapLabel.Text = "Snap length"; snapHBox.AddChild(snapLabel); snapHBox.AddChild(snapSpin); container.AddChild(snapHBox); popup.AddChild(container); popup.Connect("popup_hide", popup, "queue_free"); baseControl.AddChild(popup); popup.PopupCentered(new Vector2(200, 100)); }
public HandsGui() { IoCManager.InjectDependencies(this); var textureHandLeft = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png"); var textureHandRight = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png"); var textureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png"); var storageTexture = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png"); _rightStatusPanel = new ItemStatusPanel(true); _leftStatusPanel = new ItemStatusPanel(false); _leftButton = new ItemSlotButton(textureHandLeft, storageTexture); _rightButton = new ItemSlotButton(textureHandRight, storageTexture); var hBox = new HBoxContainer { SeparationOverride = 0, Children = { _rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel } }; AddChild(hBox); _leftButton.OnPressed += args => HandKeyBindDown(args, HandNameLeft); _leftButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameLeft); _rightButton.OnPressed += args => HandKeyBindDown(args, HandNameRight); _rightButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameRight); // Active hand _leftButton.AddChild(ActiveHandRect = new TextureRect { Texture = textureHandActive, TextureScale = (2, 2) });
public override void _Ready() { _startScreen = GetNode <HBoxContainer>("StartScreen"); _1PlayerButton = GetNode <Button>("StartScreen/VBoxContainer/PlayerOptions/1PlayerButton"); _2PlayerButton = GetNode <Button>("StartScreen/VBoxContainer/PlayerOptions/2PlayerButton"); _hud = GetNode <HUD>("HUD"); _1PlayerButton.GrabFocus(); _messageLabel = GetNode <Label>("MessageLabelContainer/MessageLabel"); _messageLabel.Hide(); _1PlayerButton.Connect( "pressed", this, nameof(OnStartButtonPressed), new Godot.Collections.Array() { 1 }); _2PlayerButton.Connect( "pressed", this, nameof(OnStartButtonPressed), new Godot.Collections.Array() { 2 }); GetNode <Timer>("MessageTimer").Connect("timeout", this, nameof(OnMessageTimer)); }
private void PerformLayout() { MouseFilter = MouseFilterMode.Stop; ToolTip = "Click to expand"; CustomMinimumSize = new Vector2(0, 25); VBox = new VBoxContainer { SeparationOverride = 0 }; AddChild(VBox); TopContainer = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; VBox.AddChild(TopContainer); BottomContainer = new HBoxContainer { Visible = false }; VBox.AddChild(BottomContainer); //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10); _bottomLabel = new Label { // FontOverride = smallFont, FontColorOverride = Color.DarkGray }; BottomContainer.AddChild(_bottomLabel); NameLabel = new Label(); TopContainer.AddChild(NameLabel); }
public StatusControl(ClientBatteryBarrelComponent parent) { _parent = parent; SizeFlagsHorizontal = SizeFlags.FillExpand; SizeFlagsVertical = SizeFlags.ShrinkCenter; AddChild(new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, Children = { (_bulletsList = new HBoxContainer { SizeFlagsVertical = SizeFlags.ShrinkCenter, SeparationOverride = 4 }), (_noBatteryLabel = new Label { Text = "No Battery!", StyleClasses = { StyleNano.StyleClassItemStatus } }) } }, new Control() { CustomMinimumSize = (5, 0) },
protected override Control MakeUI(object?value) { var hBox = new HBoxContainer(); dynamic d = value !; // NOTE: value can be both a KeyValuePair<,> here OR as a ServerKeyValuePairToken. object?valueK = d.Key; object?valueV = d.Value; // ReSharper disable ConstantConditionalAccessQualifier var typeK = valueK?.GetType(); var typeV = valueV?.GetType(); // ReSharper restore ConstantConditionalAccessQualifier _propertyEditorK = _viewVariables.PropertyFor(typeK); _propertyEditorV = _viewVariables.PropertyFor(typeV); var controlK = _propertyEditorK.Initialize(valueK, true); var controlV = _propertyEditorV.Initialize(valueV, true); hBox.AddChild(controlK); hBox.AddChild(controlV); return(hBox); }
public StatusControl(ClientBatteryBarrelComponent parent) { MinHeight = 15; _parent = parent; HorizontalExpand = true; VerticalAlignment = VAlignment.Center; AddChild(new HBoxContainer { HorizontalExpand = true, Children = { new Control { HorizontalExpand = true, Children = { (_bulletsList = new HBoxContainer { VerticalAlignment = VAlignment.Center, SeparationOverride = 4 }), (_noBatteryLabel = new Label { Text = "No Battery!", StyleClasses = { StyleNano.StyleClassItemStatus } }) } }, new Control() { MinSize = (5, 0) },
public override void _Ready() { if (Engine.EditorHint) { return; } if (exportedButtonMode == b.None) { GD.PushError("You must set exportedButtonMode for ShopUpgradeButton!"); GD.PrintStack(); GetTree().Quit(1); } name = (Label)FindNode("Name"); stat = (Label)FindNode("Stat"); statNum = (Label)FindNode("StatNum"); image = (Sprite)FindNode("Img"); costIndicator = (CostIndicator)FindNode("CostIndicator"); squaresContainer = (HBoxContainer)FindNode("Squares"); tween = (Tween)FindNode("Tween"); containerLength = squaresContainer.RectSize.x; containerHeight = squaresContainer.RectSize.y; dinoInfo = DinoInfo.Instance.GetDinoInfo(ShopInfo.shopDino); DoEverything(); }
protected override Control MakeUI(object value) { var hBox = new HBoxContainer(); var propK = value.GetType().GetProperty("Key"); var propV = value.GetType().GetProperty("Value"); var valueK = propK.GetValue(value); var valueV = propV.GetValue(value); var typeK = valueK?.GetType(); var typeV = valueV?.GetType(); var propertyEditorK = _viewVariables.PropertyFor(typeK); var propertyEditorV = _viewVariables.PropertyFor(typeV); WireReference(propertyEditorK, valueK); WireReference(propertyEditorV, valueV); var controlK = propertyEditorK.Initialize(valueK, true); var controlV = propertyEditorV.Initialize(valueV, true); hBox.AddChild(controlK); hBox.AddChild(controlV); return(hBox); }
protected override Control MakeUI(object value) { var hBox = new HBoxContainer("ViewVariablesPropertyEditorAngle") { CustomMinimumSize = new Vector2(200, 0) }; var angle = (Angle)value; var lineEdit = new LineEdit { Text = angle.Degrees.ToString(CultureInfo.InvariantCulture), Editable = !ReadOnly, SizeFlagsHorizontal = Control.SizeFlags.FillExpand }; if (!ReadOnly) { lineEdit.OnTextEntered += e => ValueChanged(Angle.FromDegrees(double.Parse(e.Text, CultureInfo.InvariantCulture))); } hBox.AddChild(lineEdit); hBox.AddChild(new Label { Text = "deg" }); return(hBox); }
private void PerformLayout() { var vBox = new VBoxContainer(); Contents.AddChild(vBox); var hBox = new HBoxContainer(); vBox.AddChild(hBox); SearchBar = new LineEdit { PlaceHolder = "Search", SizeFlagsHorizontal = SizeFlags.FillExpand }; SearchBar.OnTextChanged += OnSearchBarTextChanged; hBox.AddChild(SearchBar); ClearButton = new Button { Text = "Clear" }; ClearButton.OnPressed += OnClearButtonPressed; hBox.AddChild(ClearButton); TileList = new ItemList { SizeFlagsVertical = SizeFlags.FillExpand }; TileList.OnItemSelected += TileListOnOnItemSelected; TileList.OnItemDeselected += TileListOnOnItemDeselected; vBox.AddChild(TileList); BuildTileList(); _placementManager.PlacementCanceled += OnPlacementCanceled; }
public BodyPartButton(string slotName) { LimbSlotName = slotName; ActualButton = new Button { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, ToggleMode = true, MouseFilter = MouseFilterMode.Stop }; AddChild(ActualButton); var hBoxContainer = new HBoxContainer(); SpriteView = new SpriteView { CustomMinimumSize = new Vector2(32.0f, 32.0f) }; LimbName = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "N/A", }; hBoxContainer.AddChild(SpriteView); hBoxContainer.AddChild(LimbName); EntityControl = new Control { SizeFlagsHorizontal = SizeFlags.FillExpand }; hBoxContainer.AddChild(EntityControl); AddChild(hBoxContainer); }
public HandsGui() { IoCManager.InjectDependencies(this); _configManager.OnValueChanged(CCVars.HudTheme, UpdateHudTheme, invokeImmediately: true); AddChild(_guiContainer = new HBoxContainer { SeparationOverride = 0, HorizontalAlignment = HAlignment.Center, Children = { (_handsColumn = new VBoxContainer { Children = { (_topPanel = ItemStatusPanel.FromSide(HandLocation.Middle)), (_handsContainer = new HBoxContainer { HorizontalAlignment = HAlignment.Center }) } }), } }); _leftHandTexture = _gameHud.GetHudTexture("hand_l.png"); _middleHandTexture = _gameHud.GetHudTexture("hand_l.png"); _rightHandTexture = _gameHud.GetHudTexture("hand_r.png"); }
private void _wrappingInit(SS14Window window, string top, string bottom) { // Wrapping containers. var scrollContainer = new ScrollContainer(); scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true); window.Contents.AddChild(scrollContainer); var vBoxContainer = new VBoxContainer { SizeFlagsHorizontal = Control.SizeFlags.FillExpand, SizeFlagsVertical = Control.SizeFlags.FillExpand, }; scrollContainer.AddChild(vBoxContainer); // Handle top bar. { var headBox = new HBoxContainer(); var name = MakeTopBar(top, bottom); name.SizeFlagsHorizontal = Control.SizeFlags.FillExpand; headBox.AddChild(name); var button = new Button { Text = "Refresh" }; button.OnPressed += _ => _refresh(); headBox.AddChild(button); vBoxContainer.AddChild(headBox); } _tabs = new TabContainer(); vBoxContainer.AddChild(_tabs); }
public override void _Ready() { SlotButtonScene = GD.Load <PackedScene>("res://UI/Menu/HostMenu/SlotButton.tscn"); LabelPieceScene = GD.Load <PackedScene>("res://UI/Menu/Pieces/LabelPiece.tscn"); SelectedSaveLabel = GetNode <Label>("SelectedSave"); ResetSelectedSave(); RenameToolbar = GetNode <HBoxContainer>("RenameToolbar"); RenameEdit = RenameToolbar.GetNode <LineEdit>("NameLineEdit"); RenameToolbar.Hide(); CreateToolbar = GetNode <HBoxContainer>("CreateToolbar"); CreateEdit = CreateToolbar.GetNode <LineEdit>("NameLineEdit"); CreateToolbar.Hide(); DeleteToolbar = GetNode <HBoxContainer>("DeleteToolbar"); DeleteMessage = DeleteToolbar.GetNode <Label>("Label"); DeleteToolbar.Hide(); ToolbarScrollSeperator = GetNode <Label>("ToolbarScrollSeperator"); ToolbarScrollSeperator.Hide(); SlotsVBox = GetNode <VBoxContainer>("SlotsScroll/SlotsVBox"); ResetSlotsVBox(); }
public override void _Ready() { tree = GetTree(); title = GetNode <VBoxContainer>("TitleScreen"); start = GetNode <HBoxContainer>("StartGame"); options = GetNode <HBoxContainer>("Options"); }
public void MakeInputMapper(string actionName) { HBoxContainer container = new HBoxContainer(); //Label Label actionLabel = new Label(); actionLabel.Valign = Label.VAlign.Center; actionLabel.Text = "Controls." + actionName; actionLabel.AddChild(new Translator()); container.AddChild(actionLabel); container.AddChild(ControlUtility.MakeHorizontalFiller()); //Bound actions Godot.Array actionList = InputMap.GetActionList(actionName); foreach (object actionItem in actionList) { InputEvent inputAction = actionItem as InputEvent; MakeRebindActionButton(container, inputAction); } //Add new binding options if its not 2 there. if (actionList.Count < 2) { int difference = 2 - actionList.Count; for (int i = 0; i < difference; i++) { MakeRebindActionButton(container, null); } } GetParent().CallDeferred("add_child", container); }
private void addServer(String name, String motd1, String motd2, int current, int max) { HBoxContainer hBoxContainer = new HBoxContainer { Name = name }; // TODO server icon TextureRect icon = new TextureRect(); NoiseTexture texture = new NoiseTexture { Width = 64, Height = 64, Noise = new OpenSimplexNoise { Seed = (int)random.Randi() } }; icon.Texture = texture; Label label = new Label { Text = name + " (" + current + "/" + max + ")\n" + motd1 + "\n" + motd2 }; hBoxContainer.AddChild(icon); hBoxContainer.AddChild(label); serverList.AddChild(hBoxContainer); hBoxContainer.Connect("gui_input", this, nameof(serverInput), new Array { name }); }
public GrinderMenu(ReagentGrinderBoundUserInterface owner) { SetSize = MinSize = (512, 256); Owner = owner; Title = Loc.GetString("All-In-One Grinder 3000"); var hSplit = new HBoxContainer(); var vBoxGrindJuiceButtonPanel = new VBoxContainer { VerticalAlignment = VAlignment.Center }; GrindButton = new Button { Text = Loc.GetString("Grind"), TextAlign = Label.AlignMode.Center, MinSize = (64, 64) }; JuiceButton = new Button { Text = Loc.GetString("Juice"), TextAlign = Label.AlignMode.Center, MinSize = (64, 64) }; vBoxGrindJuiceButtonPanel.AddChild(GrindButton); //inner button padding vBoxGrindJuiceButtonPanel.AddChild(new Control { MinSize = (0, 16), });
public ServerInfo() { _richTextLabel = new RichTextLabel { SizeFlagsVertical = SizeFlags.FillExpand }; AddChild(_richTextLabel); var buttons = new HBoxContainer(); AddChild(buttons); var uriOpener = IoCManager.Resolve <IUriOpener>(); var discordButton = new Button { Text = Loc.GetString("Join us on Discord!") }; discordButton.OnPressed += args => uriOpener.OpenUri(UILinks.Discord); var websiteButton = new Button { Text = Loc.GetString("Website") }; websiteButton.OnPressed += args => uriOpener.OpenUri(UILinks.Website); buttons.AddChild(discordButton); buttons.AddChild(websiteButton); }
public HandsGui() { IoCManager.InjectDependencies(this); AddChild(_guiContainer = new HBoxContainer { SeparationOverride = 0, HorizontalAlignment = HAlignment.Center, Children = { (_handsColumn = new VBoxContainer { Children = { (_topPanel = ItemStatusPanel.FromSide(HandLocation.Middle)), (_handsContainer = new HBoxContainer { HorizontalAlignment = HAlignment.Center }) } }), } }); _leftHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png"); _middleHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png"); _rightHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_r.png"); }
public override Control BuildUI() { HBoxContainer VecUI = new HBoxContainer(); SpinBox spinboxX = new SpinBox(); SpinBox spinboxY = new SpinBox(); spinboxX.MaxValue = 10000; spinboxY.MaxValue = 10000; spinboxX.Step = 0.01; spinboxY.Step = 0.01; spinboxX.Value = ((Vector2)this.Value).x; spinboxY.Value = ((Vector2)this.Value).x; VecUI.AddChild(spinboxX); VecUI.AddChild(spinboxY); /* TODO Vec2Props currently not working because here I pass the individual spin box * values instead of a vector2 */ spinboxX.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); spinboxY.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); return(VecUI); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { scoreLabel = (Label)GetParent().FindNode("score_label"); counterLabel = (Label)GetParent().FindNode("CounterLabel"); scoreProgress = (TextureProgress)FindNode("TextureProgress"); goalConatiner = (HBoxContainer)FindNode("GoalContainer"); OnUpdateScore(0); }
public override void _Ready() { container = GetNode <HBoxContainer>("Container"); tween = new Tween(); AddChild(tween); Refresh(); }