Add ergonomic CultLib happy-path APIs
This commit is contained in:
parent
3f1cb8b36e
commit
80d0485d3c
9 changed files with 471 additions and 7 deletions
|
|
@ -164,6 +164,14 @@ namespace GameCult.Networking
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a listener for a specific 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>
|
||||
|
|
@ -178,6 +186,14 @@ namespace GameCult.Networking
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a previously registered listener for a specific message type.
|
||||
/// </summary>
|
||||
public void Off<T>(Action<T> callback) where T : Message
|
||||
{
|
||||
RemoveMessageListener(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a login request.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue