This commit is contained in:
2022-05-01 13:51:52 +04:00
parent f3961e4740
commit 2aefc47d7c
4 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Ragon.Core
public void Start()
{
_socketServer.Start(5000);
_socketServer.Start(_configuration.Server.Port);
foreach (var roomThread in _roomThreads)
roomThread.Start();
@@ -2,9 +2,16 @@
namespace Ragon.Core
{
[Serializable]
public struct Server
{
public ushort Port;
}
[Serializable]
public struct Configuration
{
public string ApiKey;
public Server Server;
}
}
+4 -2
View File
@@ -166,13 +166,15 @@ namespace Ragon.Core
case RagonOperation.REPLICATE_EVENT:
case RagonOperation.REPLICATE_ENTITY_EVENT:
{
Span<byte> data = stackalloc byte[rawData.Length];
var evntCodeData = rawData.Slice(2, 2);
var evntId = RagonHeader.ReadUShort(ref evntCodeData);
if (_plugin.InternalHandle(peerId, evntId, ref rawData)) return;
Span<byte> data = stackalloc byte[rawData.Length];
rawData.CopyTo(data);
Broadcast(_readyPlayers, data, DeliveryType.Reliable);
break;
}