Removed duplicated address storage. (#664)

* Removed duplicated address storage.

* Removed the obsoletion as per vis' request.
This commit is contained in:
rodolphito 2019-03-27 02:27:41 -07:00 committed by vis2k
parent c289ffb440
commit 595039865f

View File

@ -27,7 +27,7 @@ public class NetworkClient
internal static ConnectState connectState = ConnectState.None; internal static ConnectState connectState = ConnectState.None;
public static string serverIp { get; internal set; } = ""; public static string serverIp => connection.address;
// active is true while a client is connecting/connected // active is true while a client is connecting/connected
// (= while the network is active) // (= while the network is active)
@ -49,22 +49,20 @@ internal static void SetHandlers(NetworkConnection conn)
} }
// connect remote // connect remote
public static void Connect(string ip) public static void Connect(string address)
{ {
if (LogFilter.Debug) Debug.Log("Client Connect: " + ip); if (LogFilter.Debug) Debug.Log("Client Connect: " + address);
active = true; active = true;
RegisterSystemHandlers(false); RegisterSystemHandlers(false);
Transport.activeTransport.enabled = true; Transport.activeTransport.enabled = true;
InitializeTransportHandlers(); InitializeTransportHandlers();
serverIp = ip;
connectState = ConnectState.Connecting; connectState = ConnectState.Connecting;
Transport.activeTransport.ClientConnect(ip); Transport.activeTransport.ClientConnect(address);
// setup all the handlers // setup all the handlers
connection = new NetworkConnection(serverIp, 0); connection = new NetworkConnection(address, 0);
connection.SetHandlers(handlers); connection.SetHandlers(handlers);
} }