/** * 发送登录协议 **/ private void OnClickLogin(GameObject go, PointerEventData ed) { loginStatus = true; string host = "192.168.87.36"; int port = 9777; NetCore.Connect(host, port, () => NetCore.Receive()); _txtTips.text = "login .."; NetSender.Send <ProtoProtocol.travelerLogin>(null, (info) => { var res = info as ProtoSprotoType.travelerLogin.response; NetCore.Connect(res.ip, (int)res.port, () => NetCore.Receive()); var sendInfo = new ProtoSprotoType.login.request(); sendInfo.session = res.session; sendInfo.token = res.token; NetSender.Send <ProtoProtocol.login>(sendInfo, (loginInfo) => { var loginResInfo = loginInfo as ProtoSprotoType.login.response; Debug.Log(loginResInfo.status); if (!loginResInfo.status) { //账号密码错误 loginStatus = false; } }); }); }