Updated Popup UI and robot generation

This commit is contained in:
=
2026-04-28 16:00:55 +02:00
parent 83d9620e39
commit 5e4e325ec7
3 changed files with 18 additions and 9 deletions
+14 -6
View File
@@ -185,8 +185,8 @@ size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_constants/separation = 10 theme_override_constants/separation = 10
[node name="Popup" type="PanelContainer" parent="CanvasLayer/Control" unique_id=311359170] [node name="Popup" type="Control" parent="CanvasLayer" unique_id=1989677138]
layout_mode = 1 layout_mode = 3
anchors_preset = 8 anchors_preset = 8
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@@ -199,22 +199,30 @@ offset_bottom = 20.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="RobotNaming" type="VBoxContainer" parent="CanvasLayer/Control/Popup" unique_id=39200128] [node name="RobotNaming" type="PanelContainer" parent="CanvasLayer/Popup" unique_id=311359170]
visible = false visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Popup/RobotNaming" unique_id=39200128]
layout_mode = 2 layout_mode = 2
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=1964282829] [node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Popup/RobotNaming/VBoxContainer" unique_id=1964282829]
layout_mode = 2 layout_mode = 2
text = "Name your robot:" text = "Name your robot:"
fit_content = true fit_content = true
autowrap_mode = 0 autowrap_mode = 0
[node name="LineEdit" type="LineEdit" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=1713423672] [node name="LineEdit" type="LineEdit" parent="CanvasLayer/Popup/RobotNaming/VBoxContainer" unique_id=1713423672]
layout_mode = 2 layout_mode = 2
placeholder_text = "Name..." placeholder_text = "Name..."
max_length = 24 max_length = 24
[node name="Button" type="Button" parent="CanvasLayer/Control/Popup/RobotNaming" unique_id=279251707] [node name="Button" type="Button" parent="CanvasLayer/Popup/RobotNaming/VBoxContainer" unique_id=279251707]
layout_mode = 2 layout_mode = 2
text = "Submit" text = "Submit"
+3 -3
View File
@@ -23,11 +23,11 @@ public partial class UIHandler : Control
public void ShowNamingPopup(Robot robot) public void ShowNamingPopup(Robot robot)
{ {
VBoxContainer namingContainer = GetNode<VBoxContainer>("./Popup/RobotNaming"); PanelContainer namingContainer = GetNode<PanelContainer>("../Popup/RobotNaming");
namingContainer.Visible = true; namingContainer.Visible = true;
GameData.canMove = false; GameData.canMove = false;
LineEdit name = namingContainer.GetNode<LineEdit>("./LineEdit"); LineEdit name = namingContainer.GetNode<LineEdit>("./VBoxContainer/LineEdit");
Button button = namingContainer.GetNode<Button>("./Button"); Button button = namingContainer.GetNode<Button>("./VBoxContainer/Button");
Action handler = null; Action handler = null;
handler = () => handler = () =>
+1
View File
@@ -88,6 +88,7 @@ public partial class World : Node3D
if (Input.IsActionJustPressed("spawn_robot") && robots.Count < maxRobotCount) if (Input.IsActionJustPressed("spawn_robot") && robots.Count < maxRobotCount)
{ {
Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate<Robot>(); Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate<Robot>();
robot.Name = $"Robot #{robots.Count + 1}";
robot.Position = map[0].tiles[rand.Next(layerSize), rand.Next(layerSize)].Position; robot.Position = map[0].tiles[rand.Next(layerSize), rand.Next(layerSize)].Position;
AddChild(robot); AddChild(robot);
robots.Add(robot); robots.Add(robot);