using Godot;
using System;

[Tool]
public partial class Dialog : PanelContainer
{
	
	[Export] public string Text = "Placeholder text";
	[Export] public string Author = "NPC name";

	private Label _textBox;
	private Label _authorBox;

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		_textBox = (Label)FindChild("TextBox");
		_authorBox = (Label)FindChild("AuthorBox");
		if (!Engine.IsEditorHint())
		{
			_textBox.Text = Text;
			_authorBox.Text = Author;
		}
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		if (Engine.IsEditorHint())
		{
			if (_textBox.Text != Text) _textBox.Text = Text;
			if (_authorBox.Text != Author) _authorBox.Text = Author;
		}
	}
}