Added renaming to the robots onclick.

This commit is contained in:
=
2026-04-28 14:37:12 +02:00
parent b926be307e
commit 4b460926c5
6 changed files with 103 additions and 7 deletions
+24 -1
View File
@@ -1,3 +1,5 @@
using System;
using System.Threading.Tasks;
using Godot;
public partial class UIHandler : Control
@@ -10,7 +12,7 @@ public partial class UIHandler : Control
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void ChangeColor(Color color)
@@ -19,4 +21,25 @@ public partial class UIHandler : Control
LightHandler.RedrawLights(color);
}
public void ShowNamingPopup(Robot robot)
{
VBoxContainer namingContainer = GetNode<VBoxContainer>("./Popup/RobotNaming");
namingContainer.Visible = true;
GameData.canMove = false;
LineEdit name = namingContainer.GetNode<LineEdit>("./LineEdit");
Button button = namingContainer.GetNode<Button>("./Button");
Action handler = null;
handler = () =>
{
robot.Name = name.Text;
name.Text = "";
namingContainer.Visible = false;
GameData.canMove = true;
button.ButtonUp -= handler;
};
button.ButtonUp += handler;
}
}