NetworkClient: move PrepareForConnect code into Connect

This commit is contained in:
vis2k 2019-03-01 15:29:50 +01:00
parent 6b6d2b00a5
commit 0e5181f26a

View File

@ -52,10 +52,13 @@ internal void SetHandlers(NetworkConnection conn)
public void Connect(string ip) public void Connect(string ip)
{ {
PrepareForConnect();
if (LogFilter.Debug) { Debug.Log("Client Connect: " + ip); } if (LogFilter.Debug) { Debug.Log("Client Connect: " + ip); }
active = true;
RegisterSystemHandlers(false);
Transport.activeTransport.enabled = true;
InitializeTransportHandlers();
serverIp = ip; serverIp = ip;
connectState = ConnectState.Connecting; connectState = ConnectState.Connecting;
@ -114,14 +117,6 @@ void OnConnected()
else Debug.LogError("Skipped Connect message handling because m_Connection is null."); else Debug.LogError("Skipped Connect message handling because m_Connection is null.");
} }
void PrepareForConnect()
{
active = true;
RegisterSystemHandlers(false);
Transport.activeTransport.enabled = true;
InitializeTransportHandlers();
}
public virtual void Disconnect() public virtual void Disconnect()
{ {
connectState = ConnectState.Disconnected; connectState = ConnectState.Disconnected;