Editor/Bool/ArchBoolSheets.cs
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 stands proud adds to it, and one that opens a
// shaft voids it. Only the part knows which, so one sheet reads its mode rather than three 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;
}
switch ( cut.Mode ) {
case ArchZoneMode.Damage:
ArchBoolUi.Damage( panel, cut, refresh, changed );
break;
case ArchZoneMode.Extrude:
ArchBoolUi.Extrude( panel, cut, refresh, changed );
break;
default:
ArchBoolUi.Cut( panel, cut, refresh, changed );
break;
}
}
}