Editor UI sheets for architectural boolean parts. Each class implements IArchSheet, sets a Payload type, and builds a sidebar UI by delegating to ArchBoolUi methods for platform, beam, cut or damage depending on the part state.
using System;
namespace Sunless.Architecture;
public sealed class ArchPlatformSheet : IArchSheet
{
public Type Payload => typeof( ArchPlatformPart );
public void Build( ToolSidebarWidget panel, ArchTool tool, ArchSelection picked, Action refresh, Action changed )
{
if ( picked.Item is ArchPlatformPart platform )
{
ArchBoolUi.Platform( panel, platform, refresh, changed );
}
}
}
public sealed class ArchBeamSheet : IArchSheet
{
public Type Payload => typeof( ArchBeamPart );
public void Build( ToolSidebarWidget panel, ArchTool tool, ArchSelection picked, Action refresh, Action changed )
{
if ( picked.Item is ArchBeamPart beam )
{
ArchBoolUi.Beam( panel, beam, refresh, changed );
}
}
}
// A bite that wears damage finishes the surface it took; one that opens a shaft voids it, and only the part knows
// which - so one sheet reads both rather than two competing for the payload.
public sealed class ArchCutSheet : IArchSheet
{
public Type Payload => typeof( ArchCutPart );
public void Build( ToolSidebarWidget panel, ArchTool tool, ArchSelection picked, Action refresh, Action changed )
{
if ( picked.Item is not ArchCutPart cut )
{
return;
}
if ( cut.IsDamage )
{
ArchBoolUi.Damage( panel, cut, refresh, changed );
}
else
{
ArchBoolUi.Cut( panel, cut, refresh, changed );
}
}
}