summaryrefslogtreecommitdiff
path: root/Scripts/Game/Input.cs
diff options
context:
space:
mode:
authorSophia Pearson <codergal89@gmail.com>2022-09-04 21:52:27 +0200
committerSophia Pearson <codergal89@gmail.com>2022-09-04 21:52:27 +0200
commitf711d55d465bd8838dc55bde1f4a25d582a6bb6b (patch)
treee2b5b2ac79adf23e5f2c475ce11ee1c3c6561f0b /Scripts/Game/Input.cs
parent2f3abbb6f1141f15ef77ac27e431bc66bb0c7899 (diff)
downloadtexty-f711d55d465bd8838dc55bde1f4a25d582a6bb6b.tar.xz
texty-f711d55d465bd8838dc55bde1f4a25d582a6bb6b.zip
tests: adjust tests to new design
Diffstat (limited to 'Scripts/Game/Input.cs')
-rw-r--r--Scripts/Game/Input.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Scripts/Game/Input.cs b/Scripts/Game/Input.cs
index 2342ac2..90a9962 100644
--- a/Scripts/Game/Input.cs
+++ b/Scripts/Game/Input.cs
@@ -8,17 +8,20 @@ namespace Texty.Scripts.Game
[Signal] public delegate void UnknownInputSubmitted(string text);
private CommandParser CommandParser => GetNodeOrNull<CommandParser>($"%{nameof(CommandParser)}");
- private Label Prompt => GetNodeOrNull<Label>($"%{nameof(Prompt)}");
- private LineEdit Text => GetNodeOrNull<LineEdit>($"%{nameof(Text)}");
+ private Label PromptLabel => GetNodeOrNull<Label>($"%{nameof(PromptLabel)}");
+ private LineEdit TextInput => GetNodeOrNull<LineEdit>($"%{nameof(TextInput)}");
public override void _Ready()
{
- Text.GrabFocus();
+ TextInput.GrabFocus();
}
public void OnTextEntered(string text)
{
- Text.Clear();
+ if (text.Empty())
+ return;
+
+ TextInput.Clear();
var command = CommandParser.TryParse(text);
if (command != null)
EmitSignal(nameof(CommandSubmitted), command);