From 2f3abbb6f1141f15ef77ac27e431bc66bb0c7899 Mon Sep 17 00:00:00 2001 From: Sophia Pearson Date: Sun, 4 Sep 2022 15:43:12 +0200 Subject: game: adapt scripts to new design --- Scripts/Game/OutputBlock.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Scripts/Game/OutputBlock.cs (limited to 'Scripts/Game/OutputBlock.cs') diff --git a/Scripts/Game/OutputBlock.cs b/Scripts/Game/OutputBlock.cs new file mode 100644 index 0000000..491958c --- /dev/null +++ b/Scripts/Game/OutputBlock.cs @@ -0,0 +1,28 @@ +using Godot; + +namespace Texty.Scripts.Game +{ + public class OutputBlock : MarginContainer + { + private string _content = ""; + + private RichTextLabel ContentLabel => GetNodeOrNull($"%{nameof(ContentLabel)}"); + + [Export(PropertyHint.MultilineText)] + public string Content + { + get => ContentLabel?.BbcodeText ?? ""; + set + { + _content = value; + if (ContentLabel != null) + ContentLabel.BbcodeText = GodotSharp.Singleton.Tr(_content); + } + } + + public override void _Ready() + { + Content = _content; + } + } +} \ No newline at end of file -- cgit v1.2.3