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> /// <summary>
/// this is like SendToReady - but it doesn't check the ready flag on the connection. /// this is like SendToReady - but it doesn't check the ready flag on the connection.
/// this is used for ObjectDestroy messages. /// this is used for ObjectDestroy messages.
@ -283,11 +282,6 @@ static void SendToObservers<T>(NetworkIdentity identity, T msg, int channelId =
foreach (NetworkConnection conn in identity.observers.Values) 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);
} }
@ -330,12 +324,6 @@ public static void SendToAll<T>(T msg, int channelId = Channels.DefaultReliable,
continue; continue;
count++; 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);
} }
@ -392,12 +380,6 @@ public static void SendToReady<T>(NetworkIdentity identity, T msg, bool includeO
if ((!isOwner || includeOwner) && conn.isReady) if ((!isOwner || includeOwner) && conn.isReady)
{ {
count++; 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);
} }
} }