summaryrefslogtreecommitdiff
path: root/Scripts/Game/OutputBlock.cs
blob: 491958c32acec0f96231ff0539cf8bd81e57fec1 (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
using Godot;

namespace Texty.Scripts.Game
{
    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;
        }
    }
}