refactor: added packet delivery type for networking

This commit is contained in:
2025-07-06 16:23:37 +03:00
parent 875f865bd3
commit ac9cb72914
4 changed files with 33 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ public interface INetworkCommunicatorClient : INetworkCommunicator
{
INetworkCommunicatorClient Connect(string address, int port, string? password = null);
INetworkCommunicatorClient SendToServer<T>(T packet) where T : class, new();
INetworkCommunicatorClient SendToServer<T>(T packet, PacketDelivery packetDelivery = PacketDelivery.ReliableInOrder) where T : class, new();
}
public interface INetworkCommunicatorServer : INetworkCommunicator
@@ -32,6 +32,6 @@ public interface INetworkCommunicatorServer : INetworkCommunicator
INetworkCommunicatorServer Start(int port, int maxConnectionCount, string? password = null);
INetworkCommunicatorServer SendToClient<T>(IConnection connection, T packet) where T : class, new();
INetworkCommunicatorServer SendToAll<T>(T packet) where T : class, new();
INetworkCommunicatorServer SendToClient<T>(IConnection connection, T packet, PacketDelivery packetDelivery = PacketDelivery.ReliableInOrder) where T : class, new();
INetworkCommunicatorServer SendToAll<T>(T packet, PacketDelivery packetDelivery = PacketDelivery.ReliableInOrder) where T : class, new();
}

View File

@@ -0,0 +1,9 @@
namespace Syntriax.Engine.Network;
public enum PacketDelivery
{
ReliableInOrder,
ReliableOutOfOrder,
UnreliableInOrder,
UnreliableOutOfOrder,
};