summaryrefslogtreecommitdiff
path: root/Scripts/Terminal/OutputBlock.cs
blob: 08b2ab2d43934a891ec587925d056736672cea5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Godot;

namespace Texty.Scripts.Terminal
{
    [Tool]
    public class OutputBlock : MarginContainer
    {
        private string _content = "";

        private RichTextLabel ContentLabel => GetNodeOrNull<RichTextLabel>($"%{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;
        }
    }
}