NetworkManager.ConnectLocalClient moved higher near StartClient because it's similar

This commit is contained in:
vis2k 2019-12-31 12:06:09 +01:00
parent a472edd14c
commit 668d6a063d

View File

@ -393,6 +393,25 @@ public void StartClient(Uri uri)
OnStartClient();
}
void ConnectLocalClient()
{
if (LogFilter.Debug) Debug.Log("NetworkManager StartHost");
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
networkAddress = "localhost";
NetworkServer.ActivateLocalClientScene();
RegisterClientMessages();
// ConnectLocalServer needs to be called AFTER RegisterClientMessages
// (https://github.com/vis2k/Mirror/pull/1249/)
NetworkClient.ConnectLocalServer();
}
/// <summary>
/// This starts a network "host" - a server and client in the same application.
/// <para>The client returned from StartHost() is a special "local" client that communicates to the in-process server using a message queue instead of the real network. But in almost all other cases, it can be treated as a normal client.</para>
@ -601,25 +620,6 @@ void RegisterServerMessages()
NetworkServer.RegisterHandler<ErrorMessage>(OnServerErrorInternal, false);
}
void ConnectLocalClient()
{
if (LogFilter.Debug) Debug.Log("NetworkManager StartHost");
if (authenticator != null)
{
authenticator.OnStartClient();
authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated);
}
networkAddress = "localhost";
NetworkServer.ActivateLocalClientScene();
RegisterClientMessages();
// ConnectLocalServer needs to be called AFTER RegisterClientMessages
// (https://github.com/vis2k/Mirror/pull/1249/)
NetworkClient.ConnectLocalServer();
}
void RegisterClientMessages()
{
NetworkClient.RegisterHandler<ConnectMessage>(OnClientConnectInternal, false);