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,19 +165,17 @@ public static bool AddPlayer(NetworkConnection readyConn, short playerController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure valid ready connection
|
// ensure valid ready connection
|
||||||
if (readyConn == null)
|
if (readyConn != null)
|
||||||
{
|
{
|
||||||
|
s_IsReady = true;
|
||||||
|
s_ReadyConnection = readyConn;
|
||||||
|
}
|
||||||
|
|
||||||
if (!s_IsReady)
|
if (!s_IsReady)
|
||||||
{
|
{
|
||||||
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
|
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_IsReady = true;
|
|
||||||
s_ReadyConnection = readyConn;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerController existingPlayerController;
|
PlayerController existingPlayerController;
|
||||||
if (s_ReadyConnection.GetPlayerController(playerControllerId, out existingPlayerController))
|
if (s_ReadyConnection.GetPlayerController(playerControllerId, out existingPlayerController))
|
||||||
|
Loading…
Reference in New Issue
Block a user