feat: NetworkClient
This commit is contained in:
parent
91e88bbff8
commit
977a2abdd7
|
@ -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();
|
||||||
|
}
|
Loading…
Reference in New Issue