mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Make the logic simpler for ensuring the connection is ready
This commit is contained in:
parent
5acaf30f3a
commit
8d4f6915d1
@ -165,20 +165,18 @@ public static bool AddPlayer(NetworkConnection readyConn, short playerController
|
||||
}
|
||||
|
||||
// ensure valid ready connection
|
||||
if (readyConn == null)
|
||||
{
|
||||
if (!s_IsReady)
|
||||
{
|
||||
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (readyConn != null)
|
||||
{
|
||||
s_IsReady = true;
|
||||
s_ReadyConnection = readyConn;
|
||||
}
|
||||
|
||||
if (!s_IsReady)
|
||||
{
|
||||
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerController existingPlayerController;
|
||||
if (s_ReadyConnection.GetPlayerController(playerControllerId, out existingPlayerController))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user