Editor/Pillar/ArchPillarSheet.cs

Editor UI sheet for an architectural pillar. It builds the sidebar controls for a selected ArchPillarPart, wiring up kind (type) selection and size controls and invoking refresh/changed callbacks.

namespace Sunless.Architecture;

public sealed class ArchPillarSheet : IArchSheet
{
	public Type Payload => typeof( ArchPillarPart );

	public void Build( ToolSidebarWidget panel, ArchTool tool, ArchSelection picked, Action refresh, Action changed )
	{
		if ( picked.Item is not ArchPillarPart pillar )
		{
			return;
		}

		ArchPillarUi.Kinds( panel, tool.PillarTypes, pillar.Type,
			type =>
			{
				tool.Picked = picked.Following( ArchPillarUi.Retype( tool, pillar, type ) );
				refresh?.Invoke();
			} );
		ArchPillarUi.Sizes( panel, pillar, tool.FindPillarType( pillar.Type ), refresh, changed );
	}
}