public void OnLoginLoginServer(BaseEvent evt) { //awnet clientmsg.s2c_login loginresponse = (clientmsg.s2c_login)evt.Params["protomsg"]; string gateServerIP = loginresponse.gsip; uint gateServerPort = loginresponse.gsport; Global.uid = loginresponse.uaid; //NGUIDebug.Log("Recv GateInfo IP: " + gateServerIP + " Recv GateInfo Port: " + gateServerPort); switch (loginresponse.loginresult.ToString()) { case "login_success": awnet.Disconnect(); awnetgate.Connect(gateServerIP, (int)gateServerPort); break; case "login_accounterror": Debug.LogError("user and password error"); break; case "login_fail": Debug.LogError("login fail"); awnet.Disconnect(); Login_Server(); awnetgate.Connect(gateServerIP, (int)gateServerPort); break; } if (loginresponse.loginresult.ToString() == "login_success") { awnet.Disconnect(); awnetgate.Connect(gateServerIP, (int)gateServerPort); } else { Debug.LogError("username...... error"); } }
void OnDestroy() { awnetgate.Disconnect(); }