Editor-side model for a bridge type used by the road/bridge editor. It stores metadata (name, title, description, icon), a Deck part, which groups bridge geometry, and a list of groups to show in the UI. It has helpers to check whether a UI group should be shown and to produce a spanning part from the Deck.
using System.Collections.Generic;
namespace Sunless.Architecture;
// A panel offering every field for every type stops being readable.
public enum ArchBridgeGroup
{
Deck,
Spans,
Pier,
Ends,
Parapet
}
// A bridge with no station yet - no second list of fields to keep in step.
public sealed class ArchBridgeType
{
public int Version { get; set; } = 1;
public string Name { get; set; } = "bridge";
public string Title { get; set; } = "Bridge";
public string Description { get; set; } = "";
public string Icon { get; set; } = "linear_scale";
public ArchBridgePart Deck { get; set; } = new();
// Empty means every group, so a pre-existing type keeps its panel.
public List<ArchBridgeGroup> Shows { get; set; } = new();
public bool Wants( ArchBridgeGroup group ) => Shows.Count == 0 || Shows.Contains( group );
public ArchBridgePart Spanning( float from, float to )
{
var part = Deck.Copy( from, to );
part.Type = Name;
return part;
}
}