summaryrefslogtreecommitdiff
path: root/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts')
-rw-r--r--Scripts/Game.cs34
-rw-r--r--Scripts/Game/StatusLine.cs30
-rw-r--r--Scripts/Texty.cs30
3 files changed, 30 insertions, 64 deletions
diff --git a/Scripts/Game.cs b/Scripts/Game.cs
deleted file mode 100644
index 07dab9a..0000000
--- a/Scripts/Game.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Diagnostics;
-using Godot;
-
-namespace Texty.Scripts
-{
- public abstract class Game : MarginContainer
- {
- public CommandParser CommandParser;
- public VBoxContainer LayoutContainer;
- public OutputContainer OutputContainer;
-
- [Export(PropertyHint.File, "*.tscn")] public PackedScene OutputRowScene;
-
- public override void _Ready()
- {
- 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));
- }
-
- public void OnInputSubmitted(string text)
- {
- var newRow = OutputRowScene.Instance<OutputRow>();
- newRow.InputText = text;
-
- var command = CommandParser.TryParse(text);
- newRow.OutputText = command == null ? "Please rephrase your command" : "THE OUTPUT SHOULD GO HERE!";
-
- OutputContainer.Add(newRow);
- }
- }
-} \ No newline at end of file
diff --git a/Scripts/Game/StatusLine.cs b/Scripts/Game/StatusLine.cs
new file mode 100644
index 0000000..4a3fb23
--- /dev/null
+++ b/Scripts/Game/StatusLine.cs
@@ -0,0 +1,30 @@
+using Godot;
+
+namespace Texty.Scripts.Game
+{
+ public class StatusLine : PanelContainer
+ {
+ private string _titleText = "Title Text";
+
+ [Export]
+ public string Title
+ {
+ get => _titleText;
+ set
+ {
+ if (TitleLabel != null)
+ TitleLabel.Text = value;
+ _titleText = value;
+ }
+ }
+
+ public RichTextLabel TitleLabel;
+
+ public override void _Ready()
+ {
+ TitleLabel = GetNode<RichTextLabel>($"%{nameof(TitleLabel)}");
+ TitleLabel.Text = _titleText;
+ }
+ }
+}
+
diff --git a/Scripts/Texty.cs b/Scripts/Texty.cs
deleted file mode 100644
index 0101183..0000000
--- a/Scripts/Texty.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Godot;
-
-namespace Texty.Scripts
-{
- public class Texty : Node
- {
-
- public Game Game;
- public StartMenu StartMenu;
-
- public override void _Ready()
- {
- Game = GetNode<Game>(nameof(Game));
- StartMenu = GetNode<StartMenu>(nameof(StartMenu));
- }
-
- public void OnQuitGame()
- {
- GetTree().Notification(MainLoop.NotificationWmQuitRequest);
- }
-
- public void OnStartGame()
- {
- StartMenu.Visible = false;
- Game.Visible = true;
- }
-
- }
-}
-