Park/Buildings/PathSign.cs
using System.Text.Json.Nodes;
namespace HC3;
public sealed class PathSign : PathFurniture
{
[Property] public SignPanel SignPanel { get; set; }
[Inspectable]
public string Text
{
get => SignPanel.Text;
set
{
SignPanel.Text = value;
}
}
[Inspectable]
public Color Color
{
get => SignPanel.Color;
set
{
SignPanel.Color = value;
}
}
protected override void WriteMetadata( JsonObject json )
{
base.WriteMetadata( json );
json["Text"] = Text;
json["Color"] = Color.ToString();
}
protected override void ReadMetadata( JsonObject json )
{
base.ReadMetadata( json );
if ( json.TryGetPropertyValue( "Text", out var textNode ) )
{
Text = textNode.GetValue<string>();
}
if ( json.TryGetPropertyValue( "Color", out var colorNode ) )
{
Color = colorNode.GetValue<string>();
}
}
}