mirror of
https://github.com/Kaveinator/NetickProForUnity.git
synced 2025-10-27 10:19:07 -07:00
Implemented TransportConnection.SendUserData in LiteNetLib transport.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,20 +34,24 @@ namespace Netick.Transport
|
|||||||
|
|
||||||
public unsafe override void Send(IntPtr ptr, int length)
|
public unsafe override void Send(IntPtr ptr, int length)
|
||||||
{
|
{
|
||||||
byte* p = (byte*)ptr.ToPointer();
|
SendLNL((byte*)ptr.ToPointer(), length, DeliveryMethod.Unreliable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public unsafe override void SendUserData(IntPtr ptr, int length, TransportDeliveryMethod transportDeliveryMethod)
|
||||||
|
{
|
||||||
|
SendLNL((byte*)ptr.ToPointer(), length, transportDeliveryMethod == TransportDeliveryMethod.Reliable ? DeliveryMethod.ReliableOrdered : DeliveryMethod.Unreliable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe void SendLNL(byte* ptr, int length, DeliveryMethod deliveryMethod)
|
||||||
|
{
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
Transport._bytes[i] = p[i];
|
Transport._bytes[i] = ptr[i];
|
||||||
|
LNLPeer.Send(Transport._bytes, 0, length, deliveryMethod);
|
||||||
LNLPeer.Send(Transport._bytes, 0, length, DeliveryMethod.Unreliable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetManager _netManager;
|
private NetManager _netManager;
|
||||||
|
|
||||||
|
|
||||||
private BitBuffer _buffer;
|
private BitBuffer _buffer;
|
||||||
// private int _bufferSize;
|
|
||||||
|
|
||||||
private readonly byte[] _bytes = new byte[2048];
|
private readonly byte[] _bytes = new byte[2048];
|
||||||
private readonly byte[] _connectionBytes = new byte[200];
|
private readonly byte[] _connectionBytes = new byte[200];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.karrar.netick",
|
"name": "com.karrar.netick",
|
||||||
"version": "0.11.50",
|
"version": "0.11.51",
|
||||||
"displayName": "Netick",
|
"displayName": "Netick",
|
||||||
"description": "A networking library for unity",
|
"description": "A networking library for unity",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user