46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Godot;
|
|
|
|
public partial class UIHandler : Control
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
GetNode<ColorPickerButton>("./MainUI/HeaderContainer/Header/LightColor").Color = GameData.lightColor;
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
|
|
}
|
|
|
|
public void ChangeColor(Color color)
|
|
{
|
|
GameData.lightColor = color;
|
|
LightHandler.RedrawLights(color);
|
|
}
|
|
|
|
public void ShowNamingPopup(Robot robot)
|
|
{
|
|
PanelContainer namingContainer = GetNode<PanelContainer>("../Popup/RobotNaming");
|
|
namingContainer.Visible = true;
|
|
GameData.canMove = false;
|
|
LineEdit name = namingContainer.GetNode<LineEdit>("./VBoxContainer/LineEdit");
|
|
Button button = namingContainer.GetNode<Button>("./VBoxContainer/Button");
|
|
|
|
Action handler = null;
|
|
handler = () =>
|
|
{
|
|
robot.Name = name.Text;
|
|
name.Text = "";
|
|
namingContainer.Visible = false;
|
|
GameData.canMove = true;
|
|
button.ButtonUp -= handler;
|
|
};
|
|
|
|
button.ButtonUp += handler;
|
|
}
|
|
|
|
}
|