Add ergonomic CultLib happy-path APIs

This commit is contained in:
Meta Vens 2026-05-09 13:32:30 +01:00
commit 80d0485d3c
9 changed files with 471 additions and 7 deletions

View file

@ -111,6 +111,14 @@ namespace GameCult.Networking
});
}
/// <summary>
/// Adds a listener for a specific authenticated message type.
/// </summary>
public void On<T>(Action<T> callback) where T : Message
{
AddMessageListener(callback);
}
/// <summary>
/// Removes a previously registered listener for a specific message type.
/// </summary>
@ -125,6 +133,14 @@ namespace GameCult.Networking
}
}
/// <summary>
/// Removes a previously registered listener for a specific authenticated message type.
/// </summary>
public void Off<T>(Action<T> callback) where T : Message
{
RemoveMessageListener(callback);
}
/// <summary>
/// Stops the underlying LiteNetLib server.
/// </summary>