iFactory.Godot/BITKit/Scripts/UX/UXContainer.cs

50 lines
1.1 KiB
C#

using System.Diagnostics;
using Godot;
using Godot.Collections;
namespace BITKit;
public partial class UXContainer:Control
{
[Export] public Label label;
[Export] public RichTextLabel richTextLabel;
[Export] public Label titleLabel;
[Export] public TextureRect icon;
[Export] public Node contextContainer;
[ExportCategory(nameof(Label))]
[Export] public Array<Label> labels;
[ExportCategory(nameof(Button))]
[Export] public Button button;
[Export] public Array<Button> buttons;
[ExportCategory(nameof(TextEdit))]
[Export] public LineEdit lineEdit;
[Export] public Array<LineEdit> lineEdits;
[ExportCategory(nameof(OptionButton))]
[Export] public OptionButton optionButton;
[Export] public Array<OptionButton> optionButtons;
public string Text
{
get =>label is not null ? label.Text : richTextLabel.Text;
set
{
switch (label, richTextLabel)
{
case (not null, null):
label.Text = value;
break;
case (null, not null):
richTextLabel.Text = value;
break;
}
}
}
public void SetText(string text)
{
Text=text;
}
}