mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix(Telepathy): Implement OnServerConnectedWithAddress
This commit is contained in:
parent
237942274d
commit
9dcc6a0953
@ -11,7 +11,7 @@ public class Server : Common
|
|||||||
{
|
{
|
||||||
// events to hook into
|
// events to hook into
|
||||||
// => OnData uses ArraySegment for allocation free receives later
|
// => OnData uses ArraySegment for allocation free receives later
|
||||||
public Action<int> OnConnected;
|
public Action<int, string> OnConnected;
|
||||||
public Action<int, ArraySegment<byte>> OnData;
|
public Action<int, ArraySegment<byte>> OnData;
|
||||||
public Action<int> OnDisconnected;
|
public Action<int> OnDisconnected;
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ public int Tick(int processLimit, Func<bool> checkEnabled = null)
|
|||||||
switch (eventType)
|
switch (eventType)
|
||||||
{
|
{
|
||||||
case EventType.Connected:
|
case EventType.Connected:
|
||||||
OnConnected?.Invoke(connectionId);
|
OnConnected?.Invoke(connectionId, GetClientAddress(connectionId));
|
||||||
break;
|
break;
|
||||||
case EventType.Data:
|
case EventType.Data:
|
||||||
OnData?.Invoke(connectionId, message);
|
OnData?.Invoke(connectionId, message);
|
||||||
|
@ -178,7 +178,7 @@ public override void ServerStart()
|
|||||||
// system's hook (e.g. statistics OnData) was added is to wrap
|
// system's hook (e.g. statistics OnData) was added is to wrap
|
||||||
// them all in a lambda and always call the latest hook.
|
// them all in a lambda and always call the latest hook.
|
||||||
// (= lazy call)
|
// (= lazy call)
|
||||||
server.OnConnected = (connectionId) => OnServerConnected.Invoke(connectionId);
|
server.OnConnected = (connectionId, remoteClientAddress) => OnServerConnectedWithAddress.Invoke(connectionId, remoteClientAddress);
|
||||||
server.OnData = (connectionId, segment) => OnServerDataReceived.Invoke(connectionId, segment, Channels.Reliable);
|
server.OnData = (connectionId, segment) => OnServerDataReceived.Invoke(connectionId, segment, Channels.Reliable);
|
||||||
server.OnDisconnected = (connectionId) => OnServerDisconnected.Invoke(connectionId);
|
server.OnDisconnected = (connectionId) => OnServerDisconnected.Invoke(connectionId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user