/* * private void heartTimer_Tick(Object obj, ElapsedEventArgs e) * { * stPkgHead head = new stPkgHead(); * MemoryStream Stream = new MemoryStream(); * head.dataSize = 0; * head.iSytle = 0; * SocketMgr.SendCommonPackge(head, Stream); * Stream.Close(); * } */ void OnReceivePack(stPkgHead head, Byte[] data) { if (wait == 0) { return; } if (head.iSytle == 11) { wait--; //heartTimer.Start(); GameManager.AddGameScreen(new Hall2(namebox.text)); } if (head.iSytle == 12) { wait--; namebox = new Textbox("namebox", new Vector2(320, 400), 150, "", false); passbox = new Textbox("passbox", new Vector2(320, 430), 150, "", false); passbox.bStar = true; namebox.maxLen = 20; passbox.maxLen = 20; SocketMgr.Close(); System.Windows.Forms.MessageBox.Show("用户名密码错误或重登陆!"); } else { bHasError = true; } }
public void OnClickClose() { mSocketMgr.Close(); }
public void OnClose() { //heartTimer.Stop(); SocketMgr.OnReceivePkg -= OnReceivePack; SocketMgr.Close(); }