removed a ton of xml comments and such

This commit is contained in:
Sebastian Bularca
2026-04-19 12:46:26 +02:00
parent 8ce041e2d8
commit d05641c979
25 changed files with 221 additions and 367 deletions

View File

@@ -2,34 +2,20 @@ using System;
using System.Collections.Generic;
namespace Jovian.EncounterSystem {
/// <summary>
/// Dispatches <see cref="IEncounterEvent"/> instances (authored on dialog options) to per-type
/// handlers registered at composition time. Unknown event types are silently skipped.
/// </summary>
/// <remarks>
/// The resolver stores handlers keyed by concrete event <see cref="Type"/>. Registration wraps a
/// typed delegate in a closure that casts back to the concrete type — the cast is safe because
/// we only ever invoke the wrapped delegate via the dictionary lookup under the same key.
/// </remarks>
/// <summary>Dispatches <see cref="IEncounterEvent"/> instances to per-type handlers. Unknown types are skipped.</summary>
public class EncounterResolver {
private readonly Dictionary<Type, Action<IEncounterEvent, EncounterContext>> handlers = new();
/// <summary>Register a handler for a concrete event type. Replaces any prior registration.</summary>
/// <typeparam name="T">The event type to handle.</typeparam>
/// <param name="handler">The delegate invoked with the cast event and the resolution context.</param>
public void Register<T>(Action<T, EncounterContext> handler) where T : IEncounterEvent {
// Wrap the typed delegate so the dictionary can hold handlers for any event type uniformly.
// Cast is safe because the wrapper is only invoked via lookup under typeof(T).
handlers[typeof(T)] = (evt, ctx) => handler((T)evt, ctx);
}
/// <summary>Remove the handler registered for event type <typeparamref name="T"/>, if any.</summary>
public void Unregister<T>() where T : IEncounterEvent {
handlers.Remove(typeof(T));
}
/// <summary>Dispatch each event in <paramref name="events"/> to its registered handler, in order.
/// Null events and events with no registered handler are skipped.</summary>
/// <param name="events">The ordered event list (typically from an <see cref="EncounterDialogOption"/>).</param>
/// <param name="context">Per-resolution context passed to every handler.</param>
public void Resolve(IEnumerable<IEncounterEvent> events, EncounterContext context) {
if(events == null) {
return;