Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3531432758 | |||
| 6bda468607 |
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"key": "defaultkey",
|
||||
"socket": "udp",
|
||||
"protocol": "1.0.0",
|
||||
"statisticsInterval": 5,
|
||||
"sendRate": 50,
|
||||
|
||||
@@ -30,7 +30,19 @@ namespace Ragon.Core
|
||||
var dispatcher = new Dispatcher();
|
||||
_dispatcher = dispatcher;
|
||||
|
||||
if (configuration.Socket == "udp")
|
||||
{
|
||||
_socketServer = new ENetServer(this);
|
||||
}
|
||||
else if (configuration.Socket == "websocket")
|
||||
{
|
||||
_socketServer = new WebSocketServer(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error($"Unknown socket type {configuration.Socket}");
|
||||
}
|
||||
|
||||
_deltaTime = 1000.0f / configuration.SendRate;
|
||||
|
||||
_roomManager = new RoomManager(factory, this);
|
||||
|
||||
@@ -42,6 +42,12 @@ public class AuthorizationManager
|
||||
|
||||
public void Accepted(ushort peerId, string playerId, string playerName)
|
||||
{
|
||||
if (_playersByPeers.ContainsKey(peerId))
|
||||
{
|
||||
_logger.Warn($"Connection already authorized {peerId}");
|
||||
return;
|
||||
}
|
||||
|
||||
_serializer.Clear();
|
||||
_serializer.WriteOperation(RagonOperation.AUTHORIZED_SUCCESS);
|
||||
_serializer.WriteString(playerId);
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Ragon.Core
|
||||
{
|
||||
public string Key;
|
||||
public string Protocol;
|
||||
public string Socket;
|
||||
public int StatisticsInterval;
|
||||
public ushort SendRate;
|
||||
public ushort Port;
|
||||
@@ -20,7 +21,7 @@ namespace Ragon.Core
|
||||
public int MaxRooms;
|
||||
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly string _serverVersion = "1.0.22-rc";
|
||||
private static readonly string _serverVersion = "1.0.24-rc";
|
||||
|
||||
private static void CopyrightInfo()
|
||||
{
|
||||
|
||||
@@ -197,6 +197,7 @@ public class Entity
|
||||
public void Destroy(ReadOnlySpan<byte> payload)
|
||||
{
|
||||
var serializer = _room.GetSharedSerializer();
|
||||
|
||||
serializer.Clear();
|
||||
serializer.WriteOperation(RagonOperation.DESTROY_ENTITY);
|
||||
serializer.WriteInt(EntityId);
|
||||
@@ -236,7 +237,7 @@ public class Entity
|
||||
var targetMode = (RagonTarget) reader.ReadByte();
|
||||
var payloadData = reader.ReadData(reader.Size);
|
||||
|
||||
Span<byte> payloadRaw = stackalloc byte[reader.Size];
|
||||
Span<byte> payloadRaw = stackalloc byte[payloadData.Length];
|
||||
ReadOnlySpan<byte> payload = payloadRaw;
|
||||
payloadData.CopyTo(payloadRaw);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user