Add simple UI for selecting/building/clearing mission

This commit is contained in:
Jarrod Doyle 2024-07-22 21:09:27 +01:00
parent 2105ea7b24
commit 185af065bc
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 38 additions and 2 deletions

View File

@ -18,12 +18,15 @@ public partial class Mission : Node3D
[Export] [Export]
public bool Clear = false; public bool Clear = false;
DbFile _file; DbFile _file;
public override void _Ready() public override void _Ready()
{ {
RebuildMap(); var fileNameLineEdit = GetNode<LineEdit>("%FileNameLineEdit");
fileNameLineEdit.Text = FileName;
fileNameLineEdit.TextSubmitted += (string text) => FileName = text;
GetNode<Button>("%BuildButton").Pressed += () => RebuildMap();
GetNode<Button>("%ClearButton").Pressed += () => ClearMap();
} }
public override void _Process(double delta) public override void _Process(double delta)

View File

@ -16,3 +16,36 @@ script = ExtResource("2_w5otl")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_oxkvl") environment = SubResource("Environment_oxkvl")
[node name="UI" type="CanvasLayer" parent="."]
[node name="PanelContainer" type="PanelContainer" parent="UI"]
offset_right = 436.0
offset_bottom = 74.0
[node name="MarginContainer" type="MarginContainer" parent="UI/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="UI/PanelContainer/MarginContainer"]
layout_mode = 2
[node name="FileNameLineEdit" type="LineEdit" parent="UI/PanelContainer/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="UI/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="BuildButton" type="Button" parent="UI/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Build"
[node name="ClearButton" type="Button" parent="UI/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Clear"