/* * static GameObject SpawnGameObject(GameObject prefab, BinaryReader reader) * { * if (prefab != null) * { * // The first byte is always the type that identifies what kind of data will follow * byte type = reader.ReadByte(); * * if (type == 0) * { * // Just a plain game object * return Instantiate(prefab) as GameObject; * } * else * { * // Custom creation function * object[] objs = reader.ReadArray(prefab); * object retVal; * * UnityTools.ExecuteFirst(GetRCCs(), (byte)type, out retVal, objs); * UnityTools.Clear(objs); * * if (retVal == null) * { * Debug.LogError("Instantiating \"" + prefab.name + "\" returned null. Did you forget to return the game object from your RCC?"); * } * return retVal as GameObject; * } * } * return null; * } * * * }*/ #endregion #region Connection public void Connect() { if (!isConnected) { clientCore.Connect(); } }
private void Button_Click(object sender, RoutedEventArgs e) { int port; try { IPAddress.Parse(tbIPAddress.Text); } catch { lMessage.Content = "IP Address is not correct!"; return; } try { port = Int32.Parse(tbPort.Text); if (port < 0 || port > 65535) { throw new Exception(); } } catch { lMessage.Content = "Port is incorrect"; return; } if (ClientCore.Connect(tbIPAddress.Text, port)) { new wFileManager().Show(); Close(); } else { lMessage.Content = "Cannot connect"; } }