feat: NetworkClient

This commit is contained in:
Syntriax 2024-02-01 23:38:35 +03:00
parent 91e88bbff8
commit 977a2abdd7
1 changed files with 21 additions and 0 deletions

View File

@ -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();
}