/// <summary> /// 连接服务器函数 /// </summary> /// <param name="serverIP">服务器IP地址</param> /// <param name="serverPort">服务器端口</param> /// <param name="maxUserCount">最大玩家数</param> public void Connect(string serverIP, int serverPort, int maxUserCount) { _serverCon = new Connection(); ServerCon.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ServerCon.socket.NoDelay = true; ServerCon.socket.Connect(serverIP, serverPort); ServerCon.socket.BeginReceive(ServerCon.readBuff, 0, ServerCon.BuffRemain, SocketFlags.None, ReceiveCallBack, ServerCon); inputCenter = new InputCenter(); inputCenter.Init(this, maxUserCount); objectManager = new NetObjectManager(this); physics = new ShapPhysics(); physics.Init(); random = new IDG.FSClient.Random(20190220); }
public InputUnit(InputCenter center) { inputCenter = center; }