public static void connect(ref ConsoleSystem.Arg arg) { if (Object.FindObjectOfType(typeof(ClientConnect)) != null) { Debug.Log("Connect already in progress!"); } else if (NetCull.isClientRunning) { Debug.Log("Use net.disconnect before trying to connect to a new server."); } else { char[] separator = new char[] { ':' }; string[] strArray = arg.GetString(0, string.Empty).Split(separator); if (strArray.Length != 2) { Debug.Log("Not a valid ip - or port missing"); } else { string strURL = strArray[0]; int iPort = int.Parse(strArray[1]); Debug.Log(string.Concat(new object[] { "Connecting to ", strURL, ":", iPort })); PlayerPrefs.SetString("net.lasturl", arg.GetString(0, string.Empty)); if (ClientConnect.Instance().DoConnect(strURL, iPort)) { LoadingScreen.Show(); LoadingScreen.Update("connecting.."); } } } }
public static void connect(ref ConsoleSystem.Arg arg) { if (UnityEngine.Object.FindObjectOfType(typeof(ClientConnect))) { Debug.Log("Connect already in progress!"); return; } if (NetCull.isClientRunning) { Debug.Log("Use net.disconnect before trying to connect to a new server."); return; } string[] strArrays = arg.GetString(0, string.Empty).Split(new char[] { ':' }); if ((int)strArrays.Length != 2) { Debug.Log("Not a valid ip - or port missing"); return; } string str = strArrays[0]; int num = int.Parse(strArrays[1]); Debug.Log(string.Concat(new object[] { "Connecting to ", str, ":", num })); PlayerPrefs.SetString("net.lasturl", arg.GetString(0, string.Empty)); if (!ClientConnect.Instance().DoConnect(str, num)) { return; } LoadingScreen.Show(); LoadingScreen.Update("connecting.."); }