Compare commits
3 Commits
v1.0.23-rc
...
v1.0.25-rc
| Author | SHA1 | Date | |
|---|---|---|---|
| f83d3ea0c7 | |||
| 3564eb2adc | |||
| 3531432758 |
@@ -4,6 +4,7 @@ namespace Ragon.Common
|
||||
{
|
||||
Owner,
|
||||
ExceptOwner,
|
||||
ExceptInvoker,
|
||||
All,
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using Ragon.Common;
|
||||
|
||||
namespace Ragon.Core;
|
||||
|
||||
public class AuthorizationManager
|
||||
public class AuthorizationManager
|
||||
{
|
||||
private Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
private IApplicationHandler _provider;
|
||||
@@ -29,12 +29,12 @@ public class AuthorizationManager
|
||||
{
|
||||
if (_playersByPeers.ContainsKey(peerId))
|
||||
{
|
||||
_logger.Warn($"Connection already authorized {peerId}");
|
||||
_logger.Warn($"Connection already authorized {peerId}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var dispatcher = _gameThread.Dispatcher;
|
||||
|
||||
|
||||
_provider.OnAuthorizationRequest(key, name, additionalData.ToArray(),
|
||||
(playerId, playerName) => { dispatcher.Dispatch(() => Accepted(peerId, playerId, playerName)); },
|
||||
(errorCode) => { dispatcher.Dispatch(() => Rejected(peerId, errorCode)); });
|
||||
@@ -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);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Ragon.Core
|
||||
public int MaxRooms;
|
||||
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly string _serverVersion = "1.0.23-rc";
|
||||
private static readonly string _serverVersion = "1.0.25-rc";
|
||||
|
||||
private static void CopyrightInfo()
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Entity
|
||||
serializer.WriteData(ref payload);
|
||||
|
||||
var sendData = serializer.ToArray();
|
||||
Send(targetMode, sendData);
|
||||
RouteEvent(peerId, targetMode, sendData);
|
||||
}
|
||||
|
||||
public void ReadState(uint peerId, RagonSerializer serializer)
|
||||
@@ -208,7 +208,7 @@ public class Entity
|
||||
_room.BroadcastToReady(sendData, DeliveryType.Reliable);
|
||||
}
|
||||
|
||||
void Send(RagonTarget targetMode, byte[] sendData)
|
||||
void RouteEvent(ushort peerId, RagonTarget targetMode, byte[] sendData)
|
||||
{
|
||||
switch (targetMode)
|
||||
{
|
||||
@@ -222,6 +222,11 @@ public class Entity
|
||||
_room.BroadcastToReady(sendData, new [] { OwnerId }, DeliveryType.Reliable);
|
||||
break;
|
||||
}
|
||||
case RagonTarget.ExceptInvoker:
|
||||
{
|
||||
_room.BroadcastToReady(sendData, new[] {peerId}, DeliveryType.Reliable);
|
||||
break;
|
||||
}
|
||||
case RagonTarget.All:
|
||||
{
|
||||
_room.BroadcastToReady(sendData, DeliveryType.Reliable);
|
||||
|
||||
Reference in New Issue
Block a user