swiftlys2/docs/api/ai/
API Reference › Menu

IComponentRenderer

Interface
Namespace: SwiftlyS2.Shared.Menu · Assembly: SwiftlyS2.CS2.dll
public interface IComponentRenderer

An optional, renderer-specific way of drawing one component type.

Every component can already draw itself through IMenuComponentRenderContext), so this exists purely to let a renderer produce richer output for a component it knows well. When no component renderer is registered for a pair, the component's own output is used, which is why an unrecognised component is never an error. Registering one of these is also how a plugin teaches a renderer it does not own about a component that renderer has never seen.

View source

Properties

ComponentType

The component type this specialisation applies to. Derived types match as well.

Type ComponentType { get; }
Property Value

RendererId

The renderer this specialisation applies to.

string RendererId { get; }
Property Value

Methods

TryRender(IMenuComponent, IMenuComponentRenderContext, out MenuNode?)

Attempts to draw a component.

bool TryRender(IMenuComponent component, IMenuComponentRenderContext context, out MenuNode? node)
Parameters
Returns
false to decline, which falls back to the component's own rendering.