From 3fa2e0c976d7c6b3fd420dba2238257dd5e329f1 Mon Sep 17 00:00:00 2001 From: moneyl <8206401+Moneyl@users.noreply.github.com> Date: Tue, 14 May 2019 17:40:55 -0400 Subject: [PATCH 01/10] Removed chatbox dependence on tscn file This turned out to be much simpler than how I was initially making it. The important thing to note is that without setting the margin and anchor values for the chatbox itself (not it's children) it won't show up on the screen. --- Content.Client/Chat/ChatBox.cs | 29 +++-- Resources/Scenes/ChatBox/ChatBox.tscn | 162 -------------------------- 2 files changed, 18 insertions(+), 173 deletions(-) delete mode 100644 Resources/Scenes/ChatBox/ChatBox.tscn diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 8e756d59ad..88b778002c 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -11,8 +11,6 @@ namespace Content.Client.Chat { public class ChatBox : PanelContainer { - protected override ResourcePath ScenePath => new ResourcePath("/Scenes/ChatBox/ChatBox.tscn"); - public delegate void TextSubmitHandler(ChatBox chatBox, string text); private const int MaxLinePixelLength = 500; @@ -43,19 +41,28 @@ namespace Content.Client.Chat { base.Initialize(); - Input = GetChild("VBoxContainer/Input"); + MarginLeft = -475.0f; + MarginTop = 10.0f; + MarginRight = -10.0f; + MarginBottom = 185.0f; + + AnchorLeft = 1.0f; + AnchorRight = 1.0f; + + VBoxContainer VBox = new VBoxContainer("VBoxContainer"); + + contents = new OutputPanel(); + contents.SizeFlagsVertical = SizeFlags.FillExpand; + VBox.AddChild(contents); + + Input = new LineEdit("Input"); Input.OnKeyDown += InputKeyDown; Input.OnTextEntered += Input_OnTextEntered; - GetChild("VBoxContainer/Contents").Dispose(); + VBox.AddChild(Input); - contents = new OutputPanel - { - SizeFlagsVertical = SizeFlags.FillExpand, - }; - GetChild("VBoxContainer").AddChild(contents); - contents.SetPositionInParent(0); + AddChild(VBox); - PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Gray.WithAlpha(0.5f)}; + PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.5f) }; } protected override void MouseDown(GUIMouseButtonEventArgs e) diff --git a/Resources/Scenes/ChatBox/ChatBox.tscn b/Resources/Scenes/ChatBox/ChatBox.tscn deleted file mode 100644 index 5c01489084..0000000000 --- a/Resources/Scenes/ChatBox/ChatBox.tscn +++ /dev/null @@ -1,162 +0,0 @@ -[gd_scene load_steps=5 format=2] - -[ext_resource path="res://Engine/Fonts/CALIBRI.TTF" type="DynamicFontData" id=1] - -[sub_resource type="StyleBoxFlat" id=3] - -content_margin_left = -1.0 -content_margin_right = -1.0 -content_margin_top = -1.0 -content_margin_bottom = -1.0 -bg_color = Color( 0.501961, 0.501961, 0.501961, 0.501961 ) -draw_center = true -border_width_left = 1 -border_width_top = 1 -border_width_right = 1 -border_width_bottom = 1 -border_color = Color( 0, 0, 0, 0.501961 ) -border_blend = false -corner_radius_top_left = 0 -corner_radius_top_right = 0 -corner_radius_bottom_right = 0 -corner_radius_bottom_left = 0 -corner_detail = 8 -expand_margin_left = 1.0 -expand_margin_right = 1.0 -expand_margin_top = 1.0 -expand_margin_bottom = 1.0 -shadow_color = Color( 0, 0, 0, 0.6 ) -shadow_size = 0 -anti_aliasing = true -anti_aliasing_size = 1 -_sections_unfolded = [ "Anti Aliasing", "Border Width", "Corner Radius", "Expand Margin", "Shadow" ] - -[sub_resource type="DynamicFont" id=1] - -size = 16 -use_mipmaps = false -use_filter = false -font_data = ExtResource( 1 ) -_sections_unfolded = [ "Extra Spacing", "Font/fallback", "Settings" ] - -[sub_resource type="StyleBoxFlat" id=2] - -content_margin_left = 2.0 -content_margin_right = -1.0 -content_margin_top = -1.0 -content_margin_bottom = -1.0 -bg_color = Color( 0.0234375, 0.0234375, 0.0234375, 0.501961 ) -draw_center = true -border_width_left = 0 -border_width_top = 0 -border_width_right = 0 -border_width_bottom = 0 -border_color = Color( 0.8, 0.8, 0.8, 1 ) -border_blend = false -corner_radius_top_left = 1 -corner_radius_top_right = 1 -corner_radius_bottom_right = 0 -corner_radius_bottom_left = 0 -corner_detail = 8 -expand_margin_left = 0.0 -expand_margin_right = 0.0 -expand_margin_top = 0.0 -expand_margin_bottom = 0.0 -shadow_color = Color( 0, 0, 0, 0.6 ) -shadow_size = 0 -anti_aliasing = true -anti_aliasing_size = 1 -_sections_unfolded = [ "Content Margin", "Corner Radius", "Expand Margin" ] - -[node name="ChatBox" type="PanelContainer" index="0"] - -anchor_left = 1.0 -anchor_top = 0.0 -anchor_right = 1.0 -anchor_bottom = 0.0 -margin_left = -475.0 -margin_top = 10.0 -margin_right = -10.0 -margin_bottom = 185.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 0 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 -custom_styles/panel = SubResource( 3 ) -_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Rect", "custom_styles" ] - -[node name="VBoxContainer" type="VBoxContainer" parent="." index="0"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 1.0 -margin_top = 1.0 -margin_right = 464.0 -margin_bottom = 174.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 -alignment = 0 - -[node name="Contents" type="RichTextLabel" parent="VBoxContainer" index="0"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 463.0 -margin_bottom = 153.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = true -mouse_filter = 0 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 3 -custom_fonts/normal_font = SubResource( 1 ) -bbcode_enabled = false -bbcode_text = "" -visible_characters = -1 -percent_visible = 1.0 -meta_underlined = true -tab_size = 4 -text = "" -scroll_active = true -scroll_following = false -selection_enabled = false -override_selected_font_color = false -_sections_unfolded = [ "BBCode", "Size Flags", "custom_fonts" ] - -[node name="Input" type="LineEdit" parent="VBoxContainer" index="1"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 157.0 -margin_right = 463.0 -margin_bottom = 173.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -focus_mode = 2 -mouse_filter = 0 -mouse_default_cursor_shape = 1 -size_flags_horizontal = 1 -size_flags_vertical = 1 -custom_styles/normal = SubResource( 2 ) -custom_fonts/font = SubResource( 1 ) -focus_mode = 2 -context_menu_enabled = true -placeholder_alpha = 0.6 -caret_blink = true -caret_blink_speed = 0.5 -caret_position = 0 -_sections_unfolded = [ "Margin", "custom_colors", "custom_constants", "custom_fonts", "custom_styles" ] - - From 2917a87ce7de0ef809a43dbf79a7f4b3f7c0c818 Mon Sep 17 00:00:00 2001 From: moneyl <8206401+Moneyl@users.noreply.github.com> Date: Tue, 14 May 2019 23:23:00 -0400 Subject: [PATCH 02/10] Removed APC gui dependence on tscn file --- .../Components/Power/ApcBoundUserInterface.cs | 47 +++- Resources/Scenes/Power/Apc.tscn | 230 ------------------ 2 files changed, 42 insertions(+), 235 deletions(-) delete mode 100644 Resources/Scenes/Power/Apc.tscn diff --git a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs index be9512bbdc..7159d330a3 100644 --- a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs @@ -1,7 +1,9 @@ using System; using Content.Shared.GameObjects.Components.Power; +using OpenTK.Graphics.OpenGL4; using Robust.Client.GameObjects.Components.UserInterface; using Robust.Client.Interfaces.Graphics; +using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.GameObjects.Components.UserInterface; @@ -21,12 +23,47 @@ namespace Content.Client.GameObjects.Components.Power { base.Open(); - _window = new ApcWindow(IoCManager.Resolve()); + _window = new SS14Window(IoCManager.Resolve()) + { + MarginRight = 426.0f, MarginBottom = 270.0f + }; _window.OnClose += Close; - _breakerButton = _window.Contents.GetChild("Rows/Breaker/Breaker"); + + var rows = new VBoxContainer("Rows"); + + var statusHeader = new Label("StatusHeader") {Text = "Power Status: "}; + rows.AddChild(statusHeader); + + var breaker = new HBoxContainer("Breaker"); + var breakerLabel = new Label("Label") {Text = "Main Breaker: "}; + _breakerButton = new CheckButton(); _breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage()); - _externalPowerStateLabel = _window.Contents.GetChild