From f20bd89dc4a7bf14a88b1effcaa1887b29314525 Mon Sep 17 00:00:00 2001 From: Sophia Pearson Date: Mon, 5 Sep 2022 20:35:53 +0200 Subject: gui: split GUI into Terminal components --- Scripts/Game/Output.cs | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 Scripts/Game/Output.cs (limited to 'Scripts/Game/Output.cs') diff --git a/Scripts/Game/Output.cs b/Scripts/Game/Output.cs deleted file mode 100644 index abd3328..0000000 --- a/Scripts/Game/Output.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Godot; -using Godot.Collections; - -namespace Texty.Scripts.Game -{ - public class Output : PanelContainer - { - [Export(PropertyHint.File, "*.tscn")] public PackedScene OutputBlockScene; - public Array TextBlocks => new Array(BlockNodes.ToList().Select(block => block.Content)); - - private VBoxContainer LineContainer => GetNodeOrNull($"%{nameof(LineContainer)}"); - - private IEnumerable BlockNodes => - GD.Range(LineContainer?.GetChildCount() ?? 0) - .Select(index => LineContainer.GetChild(index)) - .Cast(); - - public override void _Ready() - { - Debug.Assert(OutputBlockScene != null, "OutputBlockScene has not been configured!"); - Debug.Assert(OutputBlockScene.CanInstance(), "OutputBlockScene can not be instanced!"); - Clear(); - } - - public void Clear() - { - BlockNodes.ToList().ForEach(block => - { - LineContainer.RemoveChild(block); - block.QueueFree(); - }); - } - - public void Push(string text) - { - if (text.Empty()) return; - var block = OutputBlockScene.Instance(); - block.Content = text; - LineContainer.AddChild(block); - } - } -} \ No newline at end of file -- cgit v1.2.3