diff --git a/Game/Network/NetworkClient.cs b/Game/Network/NetworkClient.cs new file mode 100644 index 0000000..39e617a --- /dev/null +++ b/Game/Network/NetworkClient.cs @@ -0,0 +1,21 @@ +using LiteNetLib; + +namespace Game.Network; + +public class NetworkClient +{ + public readonly EventBasedNetListener Listener = null!; + public readonly NetManager Client = null!; + + public NetworkClient() + { + Listener = new EventBasedNetListener(); + Client = new NetManager(Listener); + } + + public void Connect(string address, int port, string? password = null) + => Client.Connect(address, port, password ?? string.Empty); + + public void PollEvents() => Client.PollEvents(); + public void Stop() => Client.Stop(); +}