Added renaming to the robots onclick.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user