diff options
| -rw-r--r-- | Scripts/Game.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Scripts/Game.cs b/Scripts/Game.cs index 645c922..07dab9a 100644 --- a/Scripts/Game.cs +++ b/Scripts/Game.cs @@ -5,6 +5,7 @@ namespace Texty.Scripts { public abstract class Game : MarginContainer { + public CommandParser CommandParser; public VBoxContainer LayoutContainer; public OutputContainer OutputContainer; @@ -14,6 +15,7 @@ namespace Texty.Scripts { Debug.Assert(OutputRowScene != null, $"The {nameof(OutputRowScene)} was not set!"); + CommandParser = GetNode<CommandParser>(nameof(CommandParser)); LayoutContainer = GetNode<VBoxContainer>(nameof(LayoutContainer)); OutputContainer = LayoutContainer.GetNode<OutputContainer>(nameof(OutputContainer)); } @@ -22,7 +24,9 @@ namespace Texty.Scripts { var newRow = OutputRowScene.Instance<OutputRow>(); newRow.InputText = text; - newRow.OutputText = "THE OUTPUT SHOULD GO HERE!"; + + var command = CommandParser.TryParse(text); + newRow.OutputText = command == null ? "Please rephrase your command" : "THE OUTPUT SHOULD GO HERE!"; OutputContainer.Add(newRow); } |
