mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServer.SetClientReady: use if+else instead of if + early return
This commit is contained in:
parent
0e8b442cad
commit
c176da7bc3
@ -789,36 +789,37 @@ public static void SetClientReady(NetworkConnection conn)
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn/update all current server objects
|
||||
if (LogFilter.Debug) Debug.Log("Spawning " + NetworkIdentity.spawned.Count + " objects for conn " + conn.connectionId);
|
||||
|
||||
conn.Send(new ObjectSpawnStartedMessage());
|
||||
|
||||
foreach (NetworkIdentity identity in NetworkIdentity.spawned.Values)
|
||||
else
|
||||
{
|
||||
if (identity == null)
|
||||
// Spawn/update all current server objects
|
||||
if (LogFilter.Debug) Debug.Log("Spawning " + NetworkIdentity.spawned.Count + " objects for conn " + conn.connectionId);
|
||||
|
||||
conn.Send(new ObjectSpawnStartedMessage());
|
||||
|
||||
foreach (NetworkIdentity identity in NetworkIdentity.spawned.Values)
|
||||
{
|
||||
Debug.LogWarning("Invalid object found in server local object list (null NetworkIdentity).");
|
||||
continue;
|
||||
}
|
||||
if (!identity.gameObject.activeSelf)
|
||||
{
|
||||
continue;
|
||||
if (identity == null)
|
||||
{
|
||||
Debug.LogWarning("Invalid object found in server local object list (null NetworkIdentity).");
|
||||
continue;
|
||||
}
|
||||
if (!identity.gameObject.activeSelf)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (LogFilter.Debug) Debug.Log("Sending spawn message for current server objects name='" + identity.name + "' netId=" + identity.netId);
|
||||
|
||||
bool visible = identity.OnCheckObserver(conn);
|
||||
if (visible)
|
||||
{
|
||||
identity.AddObserver(conn);
|
||||
}
|
||||
}
|
||||
|
||||
if (LogFilter.Debug) Debug.Log("Sending spawn message for current server objects name='" + identity.name + "' netId=" + identity.netId);
|
||||
|
||||
bool visible = identity.OnCheckObserver(conn);
|
||||
if (visible)
|
||||
{
|
||||
identity.AddObserver(conn);
|
||||
}
|
||||
conn.Send(new ObjectSpawnFinishedMessage());
|
||||
}
|
||||
|
||||
conn.Send(new ObjectSpawnFinishedMessage());
|
||||
}
|
||||
|
||||
internal static void ShowForConnection(NetworkIdentity identity, NetworkConnection conn)
|
||||
|
Loading…
Reference in New Issue
Block a user