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
@@ -1,7 +1,7 @@
{ {
"apiKey": "123", "apiKey": "123",
"server": { "server": {
"port": 4444, "port": 5000,
"skipTimeout": 60 "skipTimeout": 60
}, },
"blacklist": [ "blacklist": [
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Ragon.Core
public void Start() public void Start()
{ {
_socketServer.Start(5000); _socketServer.Start(_configuration.Server.Port);
foreach (var roomThread in _roomThreads) foreach (var roomThread in _roomThreads)
roomThread.Start(); roomThread.Start();
@@ -2,9 +2,16 @@
namespace Ragon.Core namespace Ragon.Core
{ {
[Serializable]
public struct Server
{
public ushort Port;
}
[Serializable] [Serializable]
public struct Configuration public struct Configuration
{ {
public string ApiKey; public string ApiKey;
public Server Server;
} }
} }
+4 -2
View File
@@ -166,13 +166,15 @@ namespace Ragon.Core
case RagonOperation.REPLICATE_EVENT: case RagonOperation.REPLICATE_EVENT:
case RagonOperation.REPLICATE_ENTITY_EVENT: case RagonOperation.REPLICATE_ENTITY_EVENT:
{ {
Span<byte> data = stackalloc byte[rawData.Length];
var evntCodeData = rawData.Slice(2, 2); var evntCodeData = rawData.Slice(2, 2);
var evntId = RagonHeader.ReadUShort(ref evntCodeData); var evntId = RagonHeader.ReadUShort(ref evntCodeData);
if (_plugin.InternalHandle(peerId, evntId, ref rawData)) return; if (_plugin.InternalHandle(peerId, evntId, ref rawData)) return;
Span<byte> data = stackalloc byte[rawData.Length];
rawData.CopyTo(data); rawData.CopyTo(data);
Broadcast(_readyPlayers, data, DeliveryType.Reliable); Broadcast(_readyPlayers, data, DeliveryType.Reliable);
break; break;
} }