Traveller/scripts/levelGraphEditor/RoomNode.cs
Cold-Mint 968fa7d723
Support for connecting nodes. Adding taglines does not require changing random ranges in the code.
支持连接节点了。添加标语无需到代码内修改随机范围了。
2024-05-12 23:06:07 +08:00

37 lines
838 B
C#

using Godot;
namespace ColdMint.scripts.levelGraphEditor;
public partial class RoomNode : GraphNode
{
private Label? _describeLabel;
private IRoomNodeData? _roomNodeData;
public IRoomNodeData? RoomNodeData
{
get => _roomNodeData;
set
{
if (_describeLabel == null || value == null) return;
Title = value.Title;
if (value.Description.Length == 0)
{
_describeLabel.Visible = false;
}
else
{
_describeLabel.Visible = true;
_describeLabel.Text = value.Description;
}
_roomNodeData = value;
}
}
public override void _Ready()
{
base._Ready();
_describeLabel = GetNode<Label>("DescribeLabel");
}
}