コード例 #1
0
        public void MsgAnalysis(JsonData res, Action <object> action)
        {
            m2c_regist m2c = new m2c_regist();

            m2c.smaps      = new List <serverMap>();
            m2c.resultCode = res["respVo"]["resultCode"].ToString();
            m2c.resultDesc = res["respVo"]["resultDesc"].ToString();
            if (m2c.resultCode == "0")
            {
                m2c.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();
                    m2c.smaps.Add(smap);
                }
                GameEntry.WebRequestToServerComponent.SetUserIdAndSession("", "", m2c.ausession, "");
            }
            if (action != null)
            {
                action(m2c);
            }
        }
コード例 #2
0
        /// <summary>
        /// 向服务器发送注册信息成功事件
        /// </summary>
        /// <param name="obj"></param>
        public void MsgSuccessLogin(object obj)
        {
            m2c_regist msg = (m2c_regist)obj;

            if (msg.resultCode == "0")
            {
                GameEntry.Event.Fire(this, new ShowMessageEventArgs("注册成功!"));
                Close();
            }
            if (msg.resultCode == "-1")
            {
                GameEntry.Event.Fire(this, new ShowMessageEventArgs(msg.resultDesc));
            }
        }