Removed construction menu dependence on tscn file
One minor issue remains with this that I can't resolve. The construction window starts off much larger than the tscn dependent version on master. It can be shrunk manually and it'll look the same, but it'd be nice to keep it as it was. Tried manually changing the window size and changing the size flags but couldn't get it to work as I wanted.
This commit is contained in:
@@ -8,7 +8,6 @@ namespace Content.Client.Construction
|
||||
public class ConstructionButton : Button
|
||||
{
|
||||
private readonly IDisplayManager _displayManager;
|
||||
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Construction/ConstructionButton.tscn");
|
||||
|
||||
public ConstructorComponent Owner
|
||||
{
|
||||
@@ -27,6 +26,15 @@ namespace Content.Client.Construction
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
AnchorLeft = 1.0f;
|
||||
AnchorTop = 1.0f;
|
||||
AnchorRight = 1.0f;
|
||||
AnchorBottom = 1.0f;
|
||||
MarginLeft = -110.0f;
|
||||
MarginTop = -70.0f;
|
||||
MarginRight = -50.0f;
|
||||
MarginBottom = -50.0f;
|
||||
Text = "Crafting";
|
||||
OnPressed += IWasPressed;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Content.Client.Construction
|
||||
{
|
||||
public class ConstructionMenu : SS14Window
|
||||
{
|
||||
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Construction/ConstructionMenu.tscn");
|
||||
|
||||
#pragma warning disable CS0649
|
||||
[Dependency]
|
||||
@@ -61,22 +60,66 @@ namespace Content.Client.Construction
|
||||
HideOnClose = true;
|
||||
Title = "Construction";
|
||||
Visible = false;
|
||||
var split = Contents.GetChild("HSplitContainer");
|
||||
var rightSide = split.GetChild("Guide");
|
||||
var info = rightSide.GetChild("Info");
|
||||
InfoIcon = info.GetChild<TextureRect>("TextureRect");
|
||||
InfoLabel = info.GetChild<Label>("Label");
|
||||
StepList = rightSide.GetChild<ItemList>("StepsList");
|
||||
var buttons = rightSide.GetChild("Buttons");
|
||||
BuildButton = buttons.GetChild<Button>("BuildButton");
|
||||
BuildButton.OnPressed += OnBuildPressed;
|
||||
EraseButton = buttons.GetChild<Button>("EraseButton");
|
||||
EraseButton.OnToggled += OnEraseToggled;
|
||||
|
||||
var leftSide = split.GetChild("Recipes");
|
||||
SearchBar = leftSide.GetChild<LineEdit>("Search");
|
||||
var hSplitContainer = new HSplitContainer();
|
||||
|
||||
// Left side
|
||||
var recipes = new VBoxContainer("Recipes") {CustomMinimumSize = new Vector2(150.0f, 0.0f)};
|
||||
SearchBar = new LineEdit("Search") {PlaceHolder = "Search"};
|
||||
RecipeList = new Tree("Tree") {SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true};
|
||||
recipes.AddChild(SearchBar);
|
||||
recipes.AddChild(RecipeList);
|
||||
hSplitContainer.AddChild(recipes);
|
||||
|
||||
// Right side
|
||||
var guide = new VBoxContainer("Guide");
|
||||
var info = new HBoxContainer("Info");
|
||||
InfoIcon = new TextureRect("TextureRect");
|
||||
InfoLabel = new Label("Label")
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter
|
||||
};
|
||||
info.AddChild(InfoIcon);
|
||||
info.AddChild(InfoLabel);
|
||||
guide.AddChild(info);
|
||||
|
||||
var stepsLabel = new Label("Label")
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
|
||||
SizeFlagsVertical = SizeFlags.ShrinkCenter,
|
||||
Text = "Steps"
|
||||
};
|
||||
guide.AddChild(stepsLabel);
|
||||
|
||||
StepList = new ItemList("StepsList")
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.None
|
||||
};
|
||||
guide.AddChild(StepList);
|
||||
|
||||
var buttonsContainer = new HBoxContainer("Buttons");
|
||||
BuildButton = new Button("BuildButton")
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
TextAlign = Button.AlignMode.Center,
|
||||
Text = "Build!",
|
||||
Disabled = true,
|
||||
ToggleMode = false
|
||||
};
|
||||
EraseButton = new Button("EraseButton")
|
||||
{
|
||||
TextAlign = Button.AlignMode.Center, Text = "Clear Ghosts", ToggleMode = true
|
||||
};
|
||||
buttonsContainer.AddChild(BuildButton);
|
||||
buttonsContainer.AddChild(EraseButton);
|
||||
guide.AddChild(buttonsContainer);
|
||||
|
||||
hSplitContainer.AddChild(guide);
|
||||
Contents.AddChild(hSplitContainer);
|
||||
|
||||
BuildButton.OnPressed += OnBuildPressed;
|
||||
EraseButton.OnToggled += OnEraseToggled;
|
||||
SearchBar.OnTextChanged += OnTextEntered;
|
||||
RecipeList = leftSide.GetChild<Tree>("Tree");
|
||||
RecipeList.OnItemSelected += OnItemSelected;
|
||||
|
||||
PopulatePrototypeList();
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="Control" type="Button"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -110.0
|
||||
margin_top = -70.0
|
||||
margin_right = -50.0
|
||||
margin_bottom = -50.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "Crafting"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Engine/Scenes/SS14Window/SS14Window.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="SS14Window" index="0" instance=ExtResource( 1 )]
|
||||
margin_left = 99.0
|
||||
margin_right = 583.0
|
||||
margin_bottom = 357.0
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="Contents" index="0"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.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
|
||||
split_offset = 15
|
||||
collapsed = false
|
||||
dragger_visibility = 0
|
||||
|
||||
[node name="Recipes" type="VBoxContainer" parent="Contents/HSplitContainer" index="0"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 163.0
|
||||
margin_bottom = 269.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
size_flags_stretch_ratio = 0.5
|
||||
rect_min_size = Vector2( 150, 0 )
|
||||
alignment = 0
|
||||
_sections_unfolded = [ "Grow Direction", "Size Flags" ]
|
||||
|
||||
[node name="Search" type="LineEdit" parent="Contents/HSplitContainer/Recipes" index="0"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 163.0
|
||||
margin_bottom = 24.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
|
||||
secret_character = "*"
|
||||
focus_mode = 2
|
||||
context_menu_enabled = true
|
||||
placeholder_text = "Search"
|
||||
placeholder_alpha = 0.6
|
||||
caret_blink = false
|
||||
caret_blink_speed = 0.65
|
||||
caret_position = 0
|
||||
|
||||
[node name="Tree" type="Tree" parent="Contents/HSplitContainer/Recipes" index="1"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 28.0
|
||||
margin_right = 163.0
|
||||
margin_bottom = 269.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 3
|
||||
columns = 1
|
||||
allow_reselect = false
|
||||
allow_rmb_select = false
|
||||
hide_folding = false
|
||||
hide_root = true
|
||||
drop_mode_flags = 0
|
||||
select_mode = 0
|
||||
_sections_unfolded = [ "Mouse" ]
|
||||
|
||||
[node name="Guide" type="VBoxContainer" parent="Contents/HSplitContainer" index="1"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 175.0
|
||||
margin_right = 464.0
|
||||
margin_bottom = 269.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="Info" type="HBoxContainer" parent="Contents/HSplitContainer/Guide" index="0"]
|
||||
editor/display_folded = true
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 289.0
|
||||
margin_bottom = 14.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
alignment = 0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Contents/HSplitContainer/Guide/Info" index="0"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_bottom = 14.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
stretch_mode = 0
|
||||
|
||||
[node name="Label" type="Label" parent="Contents/HSplitContainer/Guide/Info" index="1"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 4.0
|
||||
margin_right = 289.0
|
||||
margin_bottom = 14.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
autowrap = true
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "Size Flags" ]
|
||||
|
||||
[node name="Label" type="Label" parent="Contents/HSplitContainer/Guide" index="1"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 127.0
|
||||
margin_top = 18.0
|
||||
margin_right = 162.0
|
||||
margin_bottom = 32.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
custom_colors/font_color = Color( 0.505882, 0.505882, 0.505882, 1 )
|
||||
text = "Steps"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="StepsList" type="ItemList" parent="Contents/HSplitContainer/Guide" index="2"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 36.0
|
||||
margin_right = 289.0
|
||||
margin_bottom = 245.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = true
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 3
|
||||
items = [ ]
|
||||
select_mode = 0
|
||||
allow_reselect = false
|
||||
icon_mode = 1
|
||||
fixed_icon_size = Vector2( 0, 0 )
|
||||
_sections_unfolded = [ "Icon", "Size Flags" ]
|
||||
|
||||
[node name="Buttons" type="HBoxContainer" parent="Contents/HSplitContainer/Guide" index="3"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 249.0
|
||||
margin_right = 289.0
|
||||
margin_bottom = 269.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="BuildButton" type="Button" parent="Contents/HSplitContainer/Guide/Buttons" index="0"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 20.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
disabled = true
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "Build!"
|
||||
flat = false
|
||||
align = 1
|
||||
_sections_unfolded = [ "Size Flags" ]
|
||||
|
||||
[node name="EraseButton" type="Button" parent="Contents/HSplitContainer/Guide/Buttons" index="1"]
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 196.0
|
||||
margin_right = 289.0
|
||||
margin_bottom = 20.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
focus_mode = 2
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
toggle_mode = true
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "Clear Ghosts"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Header" parent="." index="1"]
|
||||
rect_clip_content = false
|
||||
|
||||
[node name="Header Text" parent="Header" index="0"]
|
||||
rect_clip_content = false
|
||||
|
||||
[node name="CloseButton" parent="Header" index="1"]
|
||||
rect_clip_content = false
|
||||
|
||||
Reference in New Issue
Block a user