wip
This commit is contained in:
@@ -27,9 +27,9 @@ internal class AuthorizeFailedHandler: IHandler
|
||||
_listenerList = list;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var message = buffer.ReadString();
|
||||
var message = reader.ReadString();
|
||||
_listenerList.OnAuthorizationFailed(message);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
internal class AuthorizeSuccessHandler: IHandler
|
||||
internal class AuthorizeSuccessHandler: IHandler
|
||||
{
|
||||
private readonly RagonListenerList _listenerList;
|
||||
private readonly RagonClient _client;
|
||||
@@ -32,11 +32,11 @@ internal class AuthorizeSuccessHandler: IHandler
|
||||
_listenerList = listenerList;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var playerId = buffer.ReadString();
|
||||
var playerName = buffer.ReadString();
|
||||
var playerPayload = buffer.ReadString();
|
||||
var playerId = reader.ReadString();
|
||||
var playerName = reader.ReadString();
|
||||
var playerPayload = reader.ReadString();
|
||||
|
||||
_client.SetStatus(RagonStatus.LOBBY);
|
||||
_listenerList.OnAuthorizationSuccess(playerId, playerName, playerPayload);
|
||||
|
||||
@@ -18,7 +18,7 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
internal class EntityCreateHandler : IHandler
|
||||
internal class EntityCreateHandler : IHandler
|
||||
{
|
||||
private readonly RagonClient _client;
|
||||
private readonly RagonPlayerCache _playerCache;
|
||||
@@ -37,15 +37,15 @@ internal class EntityCreateHandler : IHandler
|
||||
_entityListener = entityListener;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var attachId = buffer.ReadUShort();
|
||||
var entityType = buffer.ReadUShort();
|
||||
var entityId = buffer.ReadUShort();
|
||||
var ownerId = buffer.ReadUShort();
|
||||
var attachId = reader.ReadUShort();
|
||||
var entityType = reader.ReadUShort();
|
||||
var entityId = reader.ReadUShort();
|
||||
var ownerId = reader.ReadUShort();
|
||||
var player = _playerCache.GetPlayerByPeer(ownerId);
|
||||
var payload = new RagonPayload(buffer.Capacity);
|
||||
payload.Read(buffer);
|
||||
var payload = new RagonPayload(reader.Capacity);
|
||||
payload.Read(reader);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
|
||||
@@ -32,12 +32,12 @@ internal class EntityEventHandler : IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var eventCode = buffer.ReadUShort();
|
||||
var peerId = buffer.ReadUShort();
|
||||
var executionMode = (RagonReplicationMode)buffer.ReadByte();
|
||||
var entityId = buffer.ReadUShort();
|
||||
var eventCode = reader.ReadUShort();
|
||||
var peerId = reader.ReadUShort();
|
||||
var executionMode = (RagonReplicationMode)reader.ReadByte();
|
||||
var entityId = reader.ReadUShort();
|
||||
|
||||
var player = _playerCache.GetPlayerByPeer(peerId);
|
||||
if (player == null)
|
||||
@@ -49,6 +49,6 @@ internal class EntityEventHandler : IHandler
|
||||
if (player.IsLocal && executionMode == RagonReplicationMode.LocalAndServer)
|
||||
return;
|
||||
|
||||
_entityCache.OnEvent(player, entityId, eventCode, buffer);
|
||||
_entityCache.OnEvent(player, entityId, eventCode, reader);
|
||||
}
|
||||
}
|
||||
@@ -35,15 +35,15 @@ internal class EntityOwnershipHandler: IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var newOwnerId = buffer.ReadUShort();
|
||||
var entities = buffer.ReadUShort();
|
||||
var newOwnerId = reader.ReadUShort();
|
||||
var entities = reader.ReadUShort();
|
||||
|
||||
var player = _playerCache.GetPlayerByPeer(newOwnerId);
|
||||
for (var i = 0; i < entities; i++)
|
||||
{
|
||||
var entityId = buffer.ReadUShort();
|
||||
var entityId = reader.ReadUShort();
|
||||
_entityCache.OnOwnershipChanged(player, entityId);
|
||||
|
||||
RagonLog.Trace("Entity changed owner: " + entityId);
|
||||
|
||||
@@ -19,7 +19,7 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
internal class EntityRemoveHandler: IHandler
|
||||
internal class EntityRemoveHandler: IHandler
|
||||
{
|
||||
private readonly RagonEntityCache _entityCache;
|
||||
|
||||
@@ -28,11 +28,11 @@ internal class EntityRemoveHandler: IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var entityId = buffer.ReadUShort();
|
||||
var payload = new RagonPayload(buffer.Capacity);
|
||||
payload.Read(buffer);
|
||||
var entityId = reader.ReadUShort();
|
||||
var payload = new RagonPayload(reader.Capacity);
|
||||
payload.Read(reader);
|
||||
|
||||
_entityCache.OnDestroy(entityId, payload);
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ internal class StateEntityHandler: IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var entitiesCount = buffer.ReadUShort();
|
||||
var entitiesCount = reader.ReadUShort();
|
||||
for (var i = 0; i < entitiesCount; i++)
|
||||
{
|
||||
var entityId = buffer.ReadUShort();
|
||||
_entityCache.OnState(entityId, buffer);
|
||||
var entityId = reader.ReadUShort();
|
||||
_entityCache.OnState(entityId, reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,5 +21,5 @@ namespace Ragon.Client;
|
||||
|
||||
public interface IHandler
|
||||
{
|
||||
public void Handle(RagonBuffer buffer);
|
||||
public void Handle(RagonBuffer reader);
|
||||
}
|
||||
@@ -28,9 +28,9 @@ internal class JoinFailedHandler: IHandler
|
||||
_listenerList = listenerList;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var message = buffer.ReadString();
|
||||
var message = reader.ReadString();
|
||||
_listenerList.OnFailed(message);
|
||||
}
|
||||
}
|
||||
@@ -57,14 +57,14 @@ internal class JoinSuccessHandler : IHandler
|
||||
_playerCache = playerCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var roomId = buffer.ReadString();
|
||||
var localId = buffer.ReadString();
|
||||
var ownerId = buffer.ReadString();
|
||||
var min = buffer.ReadUShort();
|
||||
var max = buffer.ReadUShort();
|
||||
var sceneName = buffer.ReadString();
|
||||
var roomId = reader.ReadString();
|
||||
var localId = reader.ReadString();
|
||||
var ownerId = reader.ReadString();
|
||||
var min = reader.ReadUShort();
|
||||
var max = reader.ReadUShort();
|
||||
var sceneName = reader.ReadString();
|
||||
|
||||
var scene = new RagonScene(_client, _playerCache, _entityCache, sceneName);
|
||||
var roomInfo = new RagonRoomInformation(roomId, localId, ownerId, min, max);
|
||||
|
||||
@@ -19,7 +19,7 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
internal class LeaveRoomHandler : IHandler
|
||||
internal class LeaveRoomHandler : IHandler
|
||||
{
|
||||
private readonly RagonClient _client;
|
||||
private readonly RagonListenerList _listenerList;
|
||||
@@ -35,7 +35,7 @@ internal class LeaveRoomHandler : IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
_listenerList.OnLeft();
|
||||
_entityCache.Cleanup();
|
||||
|
||||
@@ -32,9 +32,9 @@ internal class SceneLoadHandler: IHandler
|
||||
_listenerList = listenerList;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var sceneName = buffer.ReadString();
|
||||
var sceneName = reader.ReadString();
|
||||
var room = _client.Room;
|
||||
|
||||
room.Cleanup();
|
||||
|
||||
@@ -35,9 +35,9 @@ internal class OwnershipRoomHandler: IHandler
|
||||
_entityCache = entityCache;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var newOwnerId = buffer.ReadUShort();
|
||||
var newOwnerId = reader.ReadUShort();
|
||||
var player = _playerCache.GetPlayerByPeer(newOwnerId);
|
||||
|
||||
_playerCache.OnOwnershipChanged(newOwnerId);
|
||||
|
||||
@@ -33,11 +33,11 @@ internal class PlayerJoinHandler : IHandler
|
||||
_listenerList = listenerList;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var playerPeerId = buffer.ReadUShort();
|
||||
var playerId = buffer.ReadString();
|
||||
var playerName = buffer.ReadString();
|
||||
var playerPeerId = reader.ReadUShort();
|
||||
var playerId = reader.ReadString();
|
||||
var playerName = reader.ReadString();
|
||||
|
||||
_playerCache.AddPlayer(playerPeerId, playerId, playerName);
|
||||
|
||||
|
||||
@@ -36,20 +36,20 @@ internal class PlayerLeftHandler : IHandler
|
||||
_listenerList = listenerList;
|
||||
}
|
||||
|
||||
public void Handle(RagonBuffer buffer)
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var playerId = buffer.ReadString();
|
||||
var playerId = reader.ReadString();
|
||||
var player = _playerCache.GetPlayerById(playerId);
|
||||
if (player != null)
|
||||
{
|
||||
_playerCache.RemovePlayer(playerId);
|
||||
_listenerList.OnPlayerLeft(player);
|
||||
|
||||
var entities = buffer.ReadUShort();
|
||||
var entities = reader.ReadUShort();
|
||||
var toDeleteIds = new ushort[entities];
|
||||
for (var i = 0; i < entities; i++)
|
||||
{
|
||||
var entityId = buffer.ReadUShort();
|
||||
var entityId = reader.ReadUShort();
|
||||
toDeleteIds[i] = entityId;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
public class RoomDataHandler: IHandler
|
||||
{
|
||||
public void Handle(RagonBuffer reader)
|
||||
{
|
||||
var rawData = reader.RawData;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -18,12 +18,12 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
public class EventRoomHandler: IHandler
|
||||
public class RoomEventHandler: IHandler
|
||||
{
|
||||
private readonly RagonClient _client;
|
||||
private readonly RagonPlayerCache _playerCache;
|
||||
|
||||
public EventRoomHandler(
|
||||
public RoomEventHandler(
|
||||
RagonClient client,
|
||||
RagonPlayerCache playerCache
|
||||
)
|
||||
@@ -120,7 +120,7 @@ namespace Ragon.Client
|
||||
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_STATE] = new StateEntityHandler(_entityCache);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_EVENT] = new EntityEventHandler(_playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.SNAPSHOT] = new SnapshotHandler(this, listeners, _entityCache, _playerCache, _entityListener);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new EventRoomHandler(this, _playerCache);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new RoomEventHandler(this, _playerCache);
|
||||
_handlers[(byte)RagonOperation.TIMESTAMP_SYNCHRONIZATION] = new TimestampHandler(this);
|
||||
|
||||
var protocolRaw = RagonVersion.Parse(protocol);
|
||||
|
||||
@@ -68,8 +68,10 @@ namespace Ragon.Protocol
|
||||
private int _read;
|
||||
private int _write;
|
||||
private uint[] _buckets;
|
||||
private byte[] _rawData;
|
||||
private readonly UTF8Encoding _utf8Encoding = new UTF8Encoding(false, true);
|
||||
|
||||
public byte[] RawData => _rawData;
|
||||
public int ReadOffset => _read;
|
||||
public int WriteOffset => _write;
|
||||
public int Length => ((_write - 1) >> 3) + 1;
|
||||
@@ -78,6 +80,7 @@ namespace Ragon.Protocol
|
||||
public RagonBuffer(int capacity = 128)
|
||||
{
|
||||
_buckets = new uint[capacity];
|
||||
_rawData = Array.Empty<byte>();
|
||||
_read = 0;
|
||||
_write = 0;
|
||||
}
|
||||
@@ -397,6 +400,7 @@ namespace Ragon.Protocol
|
||||
|
||||
_write = ((length - 1) * 8) + positionInByte;
|
||||
_read = 0;
|
||||
_rawData = data;
|
||||
}
|
||||
|
||||
public byte[] ToArray()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ragon.Server.ENet\Ragon.Server.ENet.csproj" />
|
||||
<ProjectReference Include="..\Ragon.Server.ENetServer\Ragon.Server.ENetServer.csproj" />
|
||||
<ProjectReference Include="..\Ragon.Server.WebSocketServer\Ragon.Server.WebSocketServer.csproj" />
|
||||
<ProjectReference Include="..\Ragon.Server\Ragon.Server.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
using NLog;
|
||||
using Ragon.Server;
|
||||
using Ragon.Server.ENet;
|
||||
using Ragon.Server.ENetServer;
|
||||
using Ragon.Server.WebSocketServer;
|
||||
using Ragon.Server.IO;
|
||||
using Ragon.Server.Plugin;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
using ENet;
|
||||
using Ragon.Server.IO;
|
||||
|
||||
namespace Ragon.Server.ENet;
|
||||
namespace Ragon.Server.ENetServer;
|
||||
|
||||
public sealed class ENetConnection: INetworkConnection
|
||||
{
|
||||
+1
-1
@@ -19,7 +19,7 @@ using ENet;
|
||||
using Ragon.Protocol;
|
||||
using Ragon.Server.IO;
|
||||
|
||||
namespace Ragon.Server.ENet;
|
||||
namespace Ragon.Server.ENetServer;
|
||||
|
||||
public sealed class ENetReliableChannel: INetworkChannel
|
||||
{
|
||||
+8
-15
@@ -19,27 +19,20 @@ using NLog;
|
||||
using Ragon.Protocol;
|
||||
using Ragon.Server.IO;
|
||||
|
||||
namespace Ragon.Server.ENet
|
||||
namespace Ragon.Server.ENetServer
|
||||
{
|
||||
public sealed class ENetServer : INetworkServer
|
||||
{
|
||||
public Executor Executor => _executor;
|
||||
|
||||
private readonly Host _host;
|
||||
private readonly Host _host = new();
|
||||
private readonly ILogger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private ENetConnection[] _connections;
|
||||
private ENetConnection[] _connections = Array.Empty<ENetConnection>();
|
||||
private INetworkListener _listener;
|
||||
private uint _protocol;
|
||||
private global::ENet.Event _event;
|
||||
private Executor _executor;
|
||||
|
||||
public ENetServer()
|
||||
{
|
||||
_host = new Host();
|
||||
_executor = new Executor();
|
||||
_connections = Array.Empty<ENetConnection>();
|
||||
}
|
||||
private ENet.Event _event;
|
||||
private Executor _executor = new();
|
||||
|
||||
public void Start(INetworkListener listener, NetworkConfiguration configuration)
|
||||
{
|
||||
@@ -118,7 +111,7 @@ namespace Ragon.Server.ENet
|
||||
_event.Packet.CopyTo(dataRaw);
|
||||
_event.Packet.Dispose();
|
||||
|
||||
_listener.OnData(connection, (NetworkChannel) _event.ChannelID, dataRaw);
|
||||
_listener.OnData(connection, (NetworkChannel)_event.ChannelID, dataRaw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +123,7 @@ namespace Ragon.Server.ENet
|
||||
var packet = new Packet();
|
||||
packet.Create(data, PacketFlags.Reliable);
|
||||
|
||||
_host.Broadcast(0, ref packet);
|
||||
_host.Broadcast((byte)NetworkChannel.RELIABLE, ref packet);
|
||||
}
|
||||
|
||||
public void BroadcastUnreliable(byte[] data)
|
||||
@@ -138,7 +131,7 @@ namespace Ragon.Server.ENet
|
||||
var packet = new Packet();
|
||||
packet.Create(data, PacketFlags.None);
|
||||
|
||||
_host.Broadcast(1, ref packet);
|
||||
_host.Broadcast((byte)NetworkChannel.UNRELIABLE, ref packet);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
+1
-1
@@ -18,7 +18,7 @@ using ENet;
|
||||
using Ragon.Protocol;
|
||||
using Ragon.Server.IO;
|
||||
|
||||
namespace Ragon.Server.ENet;
|
||||
namespace Ragon.Server.ENetServer;
|
||||
|
||||
public sealed class ENetUnreliableChannel: INetworkChannel
|
||||
{
|
||||
@@ -40,7 +40,7 @@ public sealed class AuthorizationOperation: BaseOperation
|
||||
_writer = writer;
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
if (context.ConnectionStatus == ConnectionStatus.Authorized)
|
||||
{
|
||||
|
||||
@@ -29,5 +29,5 @@ public abstract class BaseOperation
|
||||
Writer = writer;
|
||||
}
|
||||
|
||||
public abstract void Handle(RagonContext context, byte[] data);
|
||||
public abstract void Handle(RagonContext context);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public sealed class EntityCreateOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var player = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
@@ -28,7 +28,7 @@ public sealed class EntityEventOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var player = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed class EntityOwnershipOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var currentOwner = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
@@ -28,7 +28,7 @@ public sealed class EntityDestroyOperation: BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var player = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
@@ -27,7 +27,7 @@ public sealed class EntityStateOperation: BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var room = context.Room;
|
||||
var player = context.RoomPlayer;
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed class RoomCreateOperation : BaseOperation
|
||||
_ragonWebHookPlugin = ragonWebHook;
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
if (context.ConnectionStatus == ConnectionStatus.Unauthorized)
|
||||
{
|
||||
|
||||
@@ -25,11 +25,13 @@ public sealed class RoomDataOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var player = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
var data = Reader.RawData;
|
||||
|
||||
Writer.Clear();
|
||||
Writer.WriteOperation(RagonOperation.REPLICATE_RAW_DATA);
|
||||
Writer.WriteUShort(player.Connection.Id);
|
||||
|
||||
@@ -9,7 +9,7 @@ public class RoomEventOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var room = context.Room;
|
||||
var player = context.RoomPlayer;
|
||||
|
||||
@@ -33,7 +33,7 @@ public sealed class RoomJoinOperation : BaseOperation
|
||||
}
|
||||
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var roomId = Reader.ReadString();
|
||||
var lobbyPlayer = context.LobbyPlayer;
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed class RoomJoinOrCreateOperation : BaseOperation
|
||||
_ragonWebHookPlugin = plugin;
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
if (context.ConnectionStatus == ConnectionStatus.Unauthorized)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class RoomLeaveOperation: BaseOperation
|
||||
_webHook = plugin;
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var room = context.Room;
|
||||
var roomPlayer = context.RoomPlayer;
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class RoomOwnershipOperation : BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SceneLoadOperation: BaseOperation
|
||||
|
||||
public SceneLoadOperation(RagonBuffer reader, RagonBuffer writer) : base(reader, writer) {}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var roomOwner = context.Room.Owner;
|
||||
var currentPlayer = context.RoomPlayer;
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class SceneLoadedOperation : BaseOperation
|
||||
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
if (context.ConnectionStatus == ConnectionStatus.Unauthorized)
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class TimestampSyncOperation: BaseOperation
|
||||
{
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, byte[] data)
|
||||
public override void Handle(RagonContext context)
|
||||
{
|
||||
var timestamp0 = Reader.Read(32);
|
||||
var timestamp1 = Reader.Read(32);
|
||||
|
||||
@@ -194,17 +194,10 @@ public class RagonServer : IRagonServer, INetworkListener
|
||||
{
|
||||
_writer.Clear();
|
||||
_reader.Clear();
|
||||
|
||||
if (channel == NetworkChannel.RAW)
|
||||
{
|
||||
_handlers[(byte)RagonOperation.REPLICATE_RAW_DATA].Handle(context, data);
|
||||
return;
|
||||
}
|
||||
|
||||
_reader.FromArray(data);
|
||||
|
||||
var operation = _reader.ReadByte();
|
||||
_handlers[operation].Handle(context, data);
|
||||
_handlers[operation].Handle(context);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -8,7 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ragon.Server", "Ragon.Serve
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ragon.Server.WebSocketServer", "Ragon.Server.WebSocketServer\Ragon.Server.WebSocketServer.csproj", "{81050343-A9B8-487B-86C8-7A5B7DD9C39B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ragon.Server.ENet", "Ragon.Server.ENet\Ragon.Server.ENet.csproj", "{DD79AC4F-9E5C-4938-850E-805D537E68D0}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ragon.Server.ENetServer", "Ragon.Server.ENetServer\Ragon.Server.ENetServer.csproj", "{DD79AC4F-9E5C-4938-850E-805D537E68D0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ragon.Client", "Ragon.Client\Ragon.Client.csproj", "{C82D65BF-6D80-4263-ADFE-CB9ED990B6C3}"
|
||||
EndProject
|
||||
|
||||
Reference in New Issue
Block a user