From d4c57c01533e52caa1c984051cad47777a9ec97a Mon Sep 17 00:00:00 2001 From: Syntriax Date: Fri, 2 Feb 2024 12:20:25 +0300 Subject: [PATCH] feat: Network Interfaces --- Game/Network/INetworkClient.cs | 6 ++++++ Game/Network/INetworkCommunicator.cs | 14 ++++++++++++++ Game/Network/INetworkServer.cs | 10 ++++++++++ 3 files changed, 30 insertions(+) create mode 100644 Game/Network/INetworkClient.cs create mode 100644 Game/Network/INetworkCommunicator.cs create mode 100644 Game/Network/INetworkServer.cs diff --git a/Game/Network/INetworkClient.cs b/Game/Network/INetworkClient.cs new file mode 100644 index 0000000..d19f094 --- /dev/null +++ b/Game/Network/INetworkClient.cs @@ -0,0 +1,6 @@ +namespace Pong.Network; + +public interface INetworkClient : INetworkCommunicator +{ + void Connect(string address, int port, string? password = null); +} diff --git a/Game/Network/INetworkCommunicator.cs b/Game/Network/INetworkCommunicator.cs new file mode 100644 index 0000000..d4e86f6 --- /dev/null +++ b/Game/Network/INetworkCommunicator.cs @@ -0,0 +1,14 @@ +using System; +using LiteNetLib; +using Syntriax.Engine.Core.Abstract; + +namespace Pong.Network; + +public interface INetworkCommunicator +{ + EventBasedNetListener Listener { get; } + NetManager Manager { get; } + + void PollEvents(); + void Stop(); +} diff --git a/Game/Network/INetworkServer.cs b/Game/Network/INetworkServer.cs new file mode 100644 index 0000000..55b8bfa --- /dev/null +++ b/Game/Network/INetworkServer.cs @@ -0,0 +1,10 @@ +namespace Pong.Network; + +public interface INetworkServer : INetworkCommunicator +{ + string Password { get; } + int MaxConnectionCount { get; } + int Port { get; } + + void Start(int port, int maxConnectionCount, string? password = null); +}