コード例 #1
0
        public void MsgAnalysis(JsonData res, Action <object> action)
        {
            Debug.Log("解析登录消息");
            //   Debug.Log(".........."+res.ToJson());
            m2c_login m2slogin = new m2c_login();

            m2slogin.smaps      = new List <serverMap>();
            m2slogin.resultCode = res["respVo"]["resultCode"].ToString();
            m2slogin.resultDesc = res["respVo"]["resultDesc"].ToString();
            if (m2slogin.resultCode == "0")
            {
                m2slogin.ausession = res["ausession"].ToString();
                for (int i = 0; i < res["server"]["serverMap"].Count; i++)
                {
                    serverMap smap = new serverMap();
                    smap.load      = res["server"]["serverMap"][i]["load"].ToString();
                    smap.id        = res["server"]["serverMap"][i]["id"].ToString();
                    smap.ip        = res["server"]["serverMap"][i]["ip"].ToString();
                    smap.name      = res["server"]["serverMap"][i]["name"].ToString();
                    smap.port      = res["server"]["serverMap"][i]["port"].ToString();
                    smap.isnew     = res["server"]["serverMap"][i]["isnew"].ToString();
                    smap.recommend = res["server"]["serverMap"][i]["recommend"].ToString();
                    m2slogin.smaps.Add(smap);
                }
                GameEntry.WebRequestToServerComponent.SetUserIdAndSession("", "", m2slogin.ausession, "");
            }
            if (action != null)
            {
                action(m2slogin);
            }
        }
コード例 #2
0
        /// <summary>
        /// 登录响应成功事件
        /// </summary>
        /// <param name="obj"></param>
        public void MsgSuccessLogin(object obj)
        {
            m2c_login msg = (m2c_login)obj;

            if (msg.resultCode == "0")
            {
                ServerListInfo.ServerList = msg.smaps;
                Dictionary <string, serverMap> serverListDic = new Dictionary <string, serverMap>();
                foreach (serverMap item in msg.smaps)
                {
                    serverListDic.Add(item.id, item);
                }
                ServerListInfo.ServerDic = serverListDic;

                NetFsnState++;
                NetFSN();
            }
            if (msg.resultCode == "-1")
            {
                m_loginConcent.SetActive(false);
                GameEntry.Event.Fire(this, new ShowMessageEventArgs(msg.resultDesc));
            }
        }