summaryrefslogtreecommitdiff
path: root/scripts/GUI/PlayerName.cs
blob: f1f5a00b8b057d3ca0b044f49880e46923fd0d6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Godot;

namespace TheLegendOfGustav.GUI;
public partial class PlayerName : Control
{

	private LineEdit nameEdit;
	private Button startButton;
	[Signal]
	public delegate void NewGameRequestEventHandler(string name);

	public override void _Ready()
	{
		nameEdit = GetNode<LineEdit>("VBoxContainer/thename");
		startButton = GetNode<Button>("VBoxContainer/Button");
		startButton.Pressed += OnClick;
	}

	private void OnClick()
	{
		string name = nameEdit.Text;
		EmitSignal(SignalName.NewGameRequest, name);
	}
}