diff --git a/Prefabs/DSL/CraftNode.tscn b/Prefabs/DSL/CraftNode.tscn index 4f32c32..65684d5 100644 --- a/Prefabs/DSL/CraftNode.tscn +++ b/Prefabs/DSL/CraftNode.tscn @@ -25,6 +25,7 @@ alignment = 1 [node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1994560318] layout_mode = 2 size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.2 text = "Craft: " fit_content = true autowrap_mode = 0 diff --git a/Prefabs/DSL/HarvestNode.tscn b/Prefabs/DSL/HarvestNode.tscn index a5688ef..a37992e 100644 --- a/Prefabs/DSL/HarvestNode.tscn +++ b/Prefabs/DSL/HarvestNode.tscn @@ -24,6 +24,8 @@ alignment = 1 [node name="Flavour" type="RichTextLabel" parent="EditorDisplay/HBoxContainer" unique_id=1393328640] layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.2 text = "Harvest: " fit_content = true autowrap_mode = 0 @@ -32,9 +34,11 @@ vertical_alignment = 1 [node name="Item" type="OptionButton" parent="EditorDisplay/HBoxContainer" unique_id=912931137] layout_mode = 2 +size_flags_horizontal = 3 [node name="Amount" type="SpinBox" parent="EditorDisplay/HBoxContainer" unique_id=1234084123] layout_mode = 2 +size_flags_horizontal = 3 rounded = true alignment = 1 prefix = "x" diff --git a/Scenes/Game.tscn b/Scenes/Game.tscn index fdd74db..6332417 100644 --- a/Scenes/Game.tscn +++ b/Scenes/Game.tscn @@ -30,10 +30,10 @@ bg_color = Color(0.053073194, 0.053073194, 0.053073194, 1) bg_color = Color(0, 0, 0, 0.7647059) [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fgofq"] -bg_color = Color(0.64705884, 0.58431375, 0.79607844, 0.5176471) +bg_color = Color(0.36567047, 0.46785766, 0.7000103, 0.5176471) [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2irst"] -bg_color = Color(0.58647984, 0.27039978, 0.75118285, 1) +bg_color = Color(0.30085096, 0.39694247, 0.6216495, 0.5176471) [node name="Main" type="Node3D" unique_id=234207355] @@ -54,7 +54,7 @@ environment = SubResource("Environment_sb48q") [node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1558432386] follow_viewport_enabled = true -[node name="UIHandler" type="Control" parent="CanvasLayer" unique_id=1713248285 node_paths=PackedStringArray("codingWindow", "robotList", "robotNaming", "information", "mainCam")] +[node name="UIHandler" type="Control" parent="CanvasLayer" unique_id=1713248285 node_paths=PackedStringArray("codingWindow", "robotList", "information", "mainCam")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -68,7 +68,6 @@ size_flags_vertical = 3 script = ExtResource("4_fgofq") codingWindow = NodePath("MainUI/Content/CodingWindow") robotList = NodePath("MainUI/Content/RobotList") -robotNaming = NodePath("Popup/RobotNaming") information = NodePath("Popup/Information") mainCam = NodePath("../../Camera3D") @@ -122,40 +121,77 @@ layout_mode = 2 size_flags_vertical = 3 [node name="CodingWindow" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1576652491 node_paths=PackedStringArray("codeBlocks", "editorWindow")] +visible = false layout_mode = 1 anchors_preset = 11 anchor_left = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -684.0 +offset_left = -524.0 grow_horizontal = 0 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs") script = ExtResource("6_7lihs") -codeBlocks = NodePath("HBoxContainer/CodeBlocks/VBoxContainer") -editorWindow = NodePath("HBoxContainer/EditorWindow/CodeContainer/VBoxContainer") +codeBlocks = NodePath("VBoxContainer/Scripting/CodeBlocks/VBoxContainer") +editorWindow = NodePath("VBoxContainer/Scripting/EditorWindow/CodeContainer/VBoxContainer") -[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" unique_id=1934932205] +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" unique_id=582741975] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="Title" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer" unique_id=90213926] +layout_mode = 2 +bbcode_enabled = true +text = "[font_size=32]Script editor[/font_size]" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 + +[node name="Renaming" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer" unique_id=408911504] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Renaming" unique_id=1964282829] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Rename your robot:" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="LineEdit" type="LineEdit" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Renaming" unique_id=1713423672] +layout_mode = 2 +size_flags_horizontal = 3 +placeholder_text = "Name..." +max_length = 24 + +[node name="Button" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Renaming" unique_id=279251707] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Submit" + +[node name="Scripting" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer" unique_id=1934932205] layout_mode = 2 size_flags_vertical = 3 -[node name="CodeBlocks" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer" unique_id=1196874464] +[node name="CodeBlocks" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting" unique_id=1196874464] layout_mode = 2 size_flags_horizontal = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_fgofq") -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/CodeBlocks" unique_id=1751038712] +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/CodeBlocks" unique_id=1751038712] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_constants/separation = 10 -[node name="EditorWindow" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer" unique_id=919757187] +[node name="EditorWindow" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting" unique_id=919757187] layout_mode = 2 size_flags_horizontal = 3 size_flags_stretch_ratio = 2.0 -[node name="CodeContainer" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=2045306791] +[node name="CodeContainer" type="ScrollContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=2045306791] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 @@ -163,54 +199,59 @@ size_flags_stretch_ratio = 2.0 theme_override_styles/panel = SubResource("StyleBoxFlat_2irst") horizontal_scroll_mode = 0 -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/CodeContainer" unique_id=632191528] +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" unique_id=632191528] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_constants/separation = 10 -[node name="Buttons" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=265797151] +[node name="Buttons" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=265797151] layout_mode = 2 theme_override_constants/separation = 20 -[node name="Clear" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons" unique_id=1191148341] +[node name="Clear" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons" unique_id=1191148341] layout_mode = 2 size_flags_horizontal = 3 text = "Clear" -[node name="Compile" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons" unique_id=1559980287] +[node name="Compile" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons" unique_id=1559980287] layout_mode = 2 size_flags_horizontal = 3 text = "Compile" -[node name="Saving" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=404804163] +[node name="Saving" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=404804163] layout_mode = 2 theme_override_constants/separation = 20 -[node name="ScriptName" type="LineEdit" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Saving" unique_id=1831524214] +[node name="ScriptName" type="LineEdit" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Saving" unique_id=1831524214] layout_mode = 2 size_flags_horizontal = 3 placeholder_text = "Name..." max_length = 24 -[node name="Save" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Saving" unique_id=599810254] +[node name="Save" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Saving" unique_id=599810254] layout_mode = 2 size_flags_horizontal = 3 text = "Save" -[node name="Load" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow" unique_id=2064954816] +[node name="Load" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=2064954816] layout_mode = 2 size_flags_horizontal = 3 text = "Load script" +[node name="Close" type="Button" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer" unique_id=200541741] +layout_mode = 2 +text = "Close" + [node name="RobotList" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1469962195 node_paths=PackedStringArray("robotList")] +visible = false layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.25 -anchor_top = 0.25 -anchor_right = 0.75 -anchor_bottom = 0.75 -grow_horizontal = 2 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -525.0 +grow_horizontal = 0 grow_vertical = 2 script = ExtResource("7_2irst") robotList = NodePath("VBoxContainer/ScrollContainer/VBoxContainer") @@ -238,6 +279,22 @@ size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_constants/separation = 10 +[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/FooterContainer" unique_id=1782436702] +layout_mode = 2 +theme_override_constants/separation = 20 +alignment = 2 + +[node name="Robots" type="Button" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=360269454] +layout_mode = 2 +text = "Robots (R)" + +[node name="Options" type="Button" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=293744135] +layout_mode = 2 +text = "Options (ESC)" + [node name="Popup" type="Control" parent="CanvasLayer/UIHandler" unique_id=1989677138] layout_mode = 1 anchors_preset = 8 @@ -252,33 +309,6 @@ offset_bottom = 19.0 grow_horizontal = 2 grow_vertical = 2 -[node name="RobotNaming" type="PanelContainer" parent="CanvasLayer/UIHandler/Popup" unique_id=311359170] -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/UIHandler/Popup/RobotNaming" unique_id=39200128] -layout_mode = 2 - -[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/Popup/RobotNaming/VBoxContainer" unique_id=1964282829] -layout_mode = 2 -text = "Name your robot:" -fit_content = true -autowrap_mode = 0 - -[node name="LineEdit" type="LineEdit" parent="CanvasLayer/UIHandler/Popup/RobotNaming/VBoxContainer" unique_id=1713423672] -layout_mode = 2 -placeholder_text = "Name..." -max_length = 24 - -[node name="Button" type="Button" parent="CanvasLayer/UIHandler/Popup/RobotNaming/VBoxContainer" unique_id=279251707] -layout_mode = 2 -text = "Submit" - [node name="Information" type="PanelContainer" parent="CanvasLayer/UIHandler/Popup" unique_id=1457118246 node_paths=PackedStringArray("title", "content")] visible = false layout_mode = 0 @@ -310,6 +340,6 @@ layout_mode = 2 text = "OK" [connection signal="color_changed" from="CanvasLayer/UIHandler/MainUI/HeaderContainer/Header/LightColor" to="CanvasLayer/UIHandler" method="ChangeColor"] -[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"] -[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/HBoxContainer/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"] +[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"] +[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"] [connection signal="pressed" from="CanvasLayer/UIHandler/Popup/Information/VBoxContainer/Button" to="CanvasLayer/UIHandler/Popup/Information" method="HideInformation"] diff --git a/Scripts/DSL/CodingWindow.cs b/Scripts/DSL/CodingWindow.cs index 47a5525..8ff9a2a 100644 --- a/Scripts/DSL/CodingWindow.cs +++ b/Scripts/DSL/CodingWindow.cs @@ -7,6 +7,7 @@ public partial class CodingWindow : PanelContainer [Export] VBoxContainer codeBlocks; [Export] VBoxContainer editorWindow; public Dictionary DSLNodes; + Robot robot; // Called when the node enters the scene tree for the first time. @@ -19,11 +20,13 @@ public partial class CodingWindow : PanelContainer // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { - //TODO: If robot that was pressed has a script, load script - if (Input.IsActionJustPressed("codingwindow")) - { - Visible = !Visible; - } + + } + + public void ShowWindow(Robot robot) + { + Visible = true; + this.robot = robot; } //Move, Harvest, Craft @@ -57,23 +60,18 @@ public partial class CodingWindow : PanelContainer public void CompileProgram() { - bool didCompile; + List nodes = new List(); for (int i = 0; i < editorWindow.GetChildCount(); i++) { - if (i + 1 < editorWindow.GetChildCount()) - { - editorWindow.GetChild(i).node.LinkNode(editorWindow.GetChild(i + 1).node); - } editorWindow.GetChild(i).node.ReadParameters(editorWindow.GetChild(i)); + nodes.Add(editorWindow.GetChild(i).node.Duplicate()); + if (i != 0) + { + nodes[i-1].nextNode = nodes[i]; + } } - ProgramInterpreter interpreter = new ProgramInterpreter(editorWindow.GetChild(0).node); - didCompile = interpreter.Execute(GameData.robots[0]); - - if (!didCompile) - { - - } + robot.SetupExecution(nodes); } } diff --git a/Scripts/DSL/Nodes/CraftNode.cs b/Scripts/DSL/Nodes/CraftNode.cs index 91e7302..5270e3a 100644 --- a/Scripts/DSL/Nodes/CraftNode.cs +++ b/Scripts/DSL/Nodes/CraftNode.cs @@ -6,12 +6,12 @@ public class CraftNode : ProgramNode { DisplayText = "Craft"; } - public override bool Execute(Robot robot) + public override bool Execute(Robot robot, double delta) { GD.Print("Craft"); if (nextNode != null) { - return nextNode.Execute(robot); + return nextNode.Execute(robot, delta); } else { @@ -23,4 +23,10 @@ public class CraftNode : ProgramNode { // } + + public override ProgramNode Duplicate() + { + CraftNode duplicate = new CraftNode(); + return duplicate; + } } \ No newline at end of file diff --git a/Scripts/DSL/Nodes/HarvestNode.cs b/Scripts/DSL/Nodes/HarvestNode.cs index e4a865d..69bc21b 100644 --- a/Scripts/DSL/Nodes/HarvestNode.cs +++ b/Scripts/DSL/Nodes/HarvestNode.cs @@ -6,12 +6,12 @@ public class HarvestNode : ProgramNode { DisplayText = "Harvest"; } - public override bool Execute(Robot robot) + public override bool Execute(Robot robot, double delta) { GD.Print("Harvest"); if (nextNode != null) { - return nextNode.Execute(robot); + return nextNode.Execute(robot, delta); } else { @@ -23,4 +23,10 @@ public class HarvestNode : ProgramNode { // } + + public override ProgramNode Duplicate() + { + HarvestNode duplicate = new HarvestNode(); + return duplicate; + } } \ No newline at end of file diff --git a/Scripts/DSL/Nodes/MoveNode.cs b/Scripts/DSL/Nodes/MoveNode.cs index c9d8247..951b3ee 100644 --- a/Scripts/DSL/Nodes/MoveNode.cs +++ b/Scripts/DSL/Nodes/MoveNode.cs @@ -8,19 +8,20 @@ public class MoveNode : ProgramNode { DisplayText = "Move"; } - public override bool Execute(Robot robot) + public override bool Execute(Robot robot, double delta) { + Vector3 worldTarget = GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].Position; + GD.Print(startPosition + "/" + worldTarget); startPosition = robot.Position; - GD.Print(targetPosition); - robot.Position = GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].Position; - if (nextNode != null) - { - return nextNode.Execute(robot); - } - else + Vector3 direction = worldTarget - startPosition; + robot.Translate(direction.Normalized() * (float)delta * GameData.robotSpeed); + float distance = direction.Length(); + if (distance < 0.1f) { + robot.Position = worldTarget; return true; } + return false; } public override void ReadParameters(NodeDisplay display) @@ -34,5 +35,12 @@ public class MoveNode : ProgramNode targetPosition = new Vector3I(posX, posY, posZ); } - + public override ProgramNode Duplicate() + { + MoveNode duplicate = new MoveNode + { + targetPosition = targetPosition + }; + return duplicate; + } } \ No newline at end of file diff --git a/Scripts/DSL/Nodes/ProgramNode.cs b/Scripts/DSL/Nodes/ProgramNode.cs index f05a01e..8d6d3a2 100644 --- a/Scripts/DSL/Nodes/ProgramNode.cs +++ b/Scripts/DSL/Nodes/ProgramNode.cs @@ -2,17 +2,10 @@ using Godot; public abstract class ProgramNode { - protected ProgramNode nextNode; + public ProgramNode nextNode; public string DisplayText; - public ProgramNode() - { - - } - public abstract bool Execute(Robot robot); + public abstract bool Execute(Robot robot, double delta); public abstract void ReadParameters(NodeDisplay display); - public void LinkNode(ProgramNode nextNode) - { - this.nextNode = nextNode; - } + public abstract ProgramNode Duplicate(); } \ No newline at end of file diff --git a/Scripts/DSL/ProgramInterpreter.cs b/Scripts/DSL/ProgramInterpreter.cs deleted file mode 100644 index c43fb99..0000000 --- a/Scripts/DSL/ProgramInterpreter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using Godot; - -public class ProgramInterpreter -{ - ProgramNode startNode; - public ProgramInterpreter(ProgramNode startNode) - { - this.startNode = startNode; - } - - public bool Execute(Robot robot) - { - return startNode.Execute(robot); - } - - -} \ No newline at end of file diff --git a/Scripts/DSL/ProgramInterpreter.cs.uid b/Scripts/DSL/ProgramInterpreter.cs.uid deleted file mode 100644 index 7bd84f1..0000000 --- a/Scripts/DSL/ProgramInterpreter.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://hui5wolo5rbr diff --git a/Scripts/Helpers/GameData.cs b/Scripts/Helpers/GameData.cs index dd7d39c..28dde25 100644 --- a/Scripts/Helpers/GameData.cs +++ b/Scripts/Helpers/GameData.cs @@ -12,6 +12,7 @@ public partial class GameData public static bool canMove = true; public static int maxRobotCount = 1000; public static List robots = new List(); + public static float robotSpeed = 5f; //--- PLAYER ADJUSTABLE VALUES --- //Color used in primary objects (e.g. Robots) diff --git a/Scripts/Helpers/UIHandler.cs b/Scripts/Helpers/UIHandler.cs index c93bca1..7f53930 100644 --- a/Scripts/Helpers/UIHandler.cs +++ b/Scripts/Helpers/UIHandler.cs @@ -6,7 +6,6 @@ public partial class UIHandler : Control { [Export] CodingWindow codingWindow; [Export] RobotList robotList; - [Export] PanelContainer robotNaming; [Export] Information information; [Export] Camera3D mainCam; public override void _Ready() @@ -19,7 +18,8 @@ public partial class UIHandler : Control { robotList.OnRobotJumpTo += (robot) => { - mainCam.Position = new Vector3(robot.Position.X, mainCam.Position.Y, robot.Position.Z); + mainCam.Position = new Vector3(robot.Position.X, mainCam.Position.Y, robot.Position.Z + 3f); + ShowCodingWindow(robot); }; } @@ -29,25 +29,8 @@ public partial class UIHandler : Control LightHandler.RedrawLights(color); } - public void ShowNamingPopup(Robot robot) + public void ShowCodingWindow(Robot robot) { - robotNaming.Visible = true; - GameData.canMove = false; - LineEdit name = robotNaming.GetNode("./VBoxContainer/LineEdit"); - name.Text = robot.Name; - Button button = robotNaming.GetNode