void ChooseServerSuccess(object obj) { //Debug.Log("游戏服务器登陆成功"); m2c_getsession m2c = (m2c_getsession)obj; GetUserInfo(m2c); }
public void MsgAnalysis(JsonData res, Action <object> action) { m2c_getsession m2c = new m2c_getsession(); m2c.resultCode = res["respVo"]["resultCode"].ToString(); m2c.resultDesc = res["respVo"]["resultDesc"].ToString(); if (m2c.resultCode == "0") { //Debug.Log(res.ToJson()); if (res["user"]["userMap"].Count == 0) { GameEntry.UI.OpenUIForm(UIFormId.MessageForm); GameEntry.Event.Fire(1, new ShowMessageEventArgs("服务器异常!")); return; } m2c.id = res["user"]["userMap"][0]["name"].ToString(); m2c.session = res["user"]["userMap"][0]["session"].ToString(); m2c.auid = res["user"]["userMap"][0]["id"].ToString(); GameEntry.WebRequestToServerComponent.SetUserIdAndSession(m2c.id, m2c.session, "", ""); GameEntry.WebRequestToServerComponent.SetGameServerUrl(serverurl); } if (action != null) { action(m2c); } }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="auid"></param> void GetUserInfo(m2c_getsession data) { m2s_getuserinfo msg = new m2s_getuserinfo(); msg.auid = data.auid; msg.session = data.session; M2SInfo m2sInfo = new M2SInfo(msg, GetUserInfoSuccess, MsgFailureLogin); GameEntry.WebRequestToServerComponent.SendJsonMsg(m2sInfo); }