NetworkServer.SendToAll/SendToObservers: remove LocalConnectionToClient check because they both use Send now

This commit is contained in:
vis2k 2021-02-18 17:19:48 +08:00
parent 3896722a49
commit a8db766837

View File

@ -258,7 +258,6 @@ public static void ActivateHostScene()
}
}
/// <summary>
/// this is like SendToReady - but it doesn't check the ready flag on the connection.
/// this is used for ObjectDestroy messages.
@ -283,12 +282,7 @@ static void SendToObservers<T>(NetworkIdentity identity, T msg, int channelId =
foreach (NetworkConnection conn in identity.observers.Values)
{
// use local connection directly because it doesn't send via transport
if (conn is LocalConnectionToClient)
conn.Send(segment);
// send to regular connection
else
conn.Send(segment, channelId);
conn.Send(segment, channelId);
}
NetworkDiagnostics.OnSend(msg, channelId, segment.Count, identity.observers.Count);
@ -330,13 +324,7 @@ public static void SendToAll<T>(T msg, int channelId = Channels.DefaultReliable,
continue;
count++;
// use local connection directly because it doesn't send via transport
if (conn is LocalConnectionToClient)
conn.Send(segment);
// send to regular connection
else
conn.Send(segment, channelId);
conn.Send(segment, channelId);
}
NetworkDiagnostics.OnSend(msg, channelId, segment.Count, count);
@ -392,13 +380,7 @@ public static void SendToReady<T>(NetworkIdentity identity, T msg, bool includeO
if ((!isOwner || includeOwner) && conn.isReady)
{
count++;
// use local connection directly because it doesn't send via transport
if (conn is LocalConnectionToClient)
conn.Send(segment);
// send to connection
else
conn.Send(segment, channelId);
conn.Send(segment, channelId);
}
}