private void OnLoginPro(MemoryStream ms, BaseMessage bs, UInt64 msgNum)
        {
            LoginMsg.C2SLogin msg = new LoginMsg.C2SLogin();
            msg = ProtoBuf.Serializer.Deserialize<LoginMsg.C2SLogin>(ms);
            ms.Close();
            Console.WriteLine("用户名:" + msg.account + ",密码:" + msg.password);

            //回包
            //MemoryStream msmsg = new MemoryStream();
            LoginMsg.S2CLogin rmsg = new LoginMsg.S2CLogin();
            deploy.USER_INFO userinfo = GameConfig.Instance.userInfoData.Exist(msg.account, msg.password);
            if (userinfo != null)
            {
                if (!m_dicUserinfo.ContainsKey((ulong)userinfo.id))
                {
                    IPEndPoint savesender = new IPEndPoint(bs.sender.Address, bs.sender.Port);//记录地址端口
                    UserInfo userInfo = new UserInfo();
                    userInfo.sender = savesender;
                    m_dicUserinfo.Add((ulong)userinfo.id, userInfo);
                }
                else
                {
                    m_dicUserinfo[(ulong)userinfo.id].sender = new IPEndPoint(bs.sender.Address, bs.sender.Port);//记录地址端口
                    Console.WriteLine("重登陆!");
                }

                rmsg.userId = (ulong)userinfo.id;
                m_dicUserinfo[(ulong)userinfo.id].heartTime = MsgResend.GetTime();//记录心跳
                m_dicUserinfo[(ulong)userinfo.id].msgRecvNum = msgNum;//消息接收号  

                m_dicUserinfo[(ulong)userinfo.id].hp = userinfo.hp;
                if (m_dicUserinfo[(ulong)userinfo.id].roomID != 0)
                    BattleManager.Instance.RemoveRoomUserAndSendMsg((ulong)userinfo.id, m_dicUserinfo[(ulong)userinfo.id].roomID);//删除房间用户并发消息                                                       
            }
            else
            {
                rmsg.userId = 0;
            }

            if (rmsg.userId != 0)
            {
                //填写角色数据
                rmsg.type = (int)Enum.Parse(typeof(BaseActor.Type), userinfo.actor_type);//角色类型//字符串转值
                rmsg.hp = m_dicUserinfo[(ulong)userinfo.id].hp;
                rmsg.name = userinfo.name;
                //填写枪信息                            
                string[] use_gun = userinfo.use_gun.Split(',');
                string[] gun_id = userinfo.gun_id.Split(',');
                for (int i = 0; i < gun_id.Length; i++)
                {
                    //枪信息
                    int gunid = Convert.ToInt32(gun_id[i]);
                    bool use = Convert.ToBoolean(use_gun[i]);
                    deploy.GUN_INFO gf = GameConfig.Instance.gunInfoData.GetData(gunid);

                    LoginMsg.GunInfo guninfo = new LoginMsg.GunInfo();
                    rmsg.GunInfo.Add(guninfo);
                    guninfo.id = gunid;
                    guninfo.use = use;
                    guninfo.experience = gf.experience;
                    guninfo.quality = (int)Enum.Parse(typeof(Gun.Quality), gf.quality);
                    guninfo.count = gf.count;
                    guninfo.bullet_quality = gf.bullet_quality;
                    guninfo.caliber = gf.caliber;
                    guninfo.speed = gf.speed;
                    guninfo.frequency = gf.frequency;
                    guninfo.accurate = gf.accurate;
                    guninfo.range = gf.range;
                    guninfo.recoil = gf.recoil;
                    guninfo.weight = gf.weight;
                    guninfo.swap_speed = gf.swap_speed;
                    guninfo.aim_scale = gf.aim_scale;
                }

                rmsg.money = userinfo.money;
                rmsg.diamonds = userinfo.diamonds;
                rmsg.experience = userinfo.experience;
                rmsg.integral = userinfo.integral;
                rmsg.experience_rank = userinfo.experience_rank;
                rmsg.integral_rank = userinfo.integral_rank;
                rmsg.modelType = userinfo.model_type;
            }

            //ProtoBuf.Serializer.Serialize<LoginMsg.S2CLogin>(msmsg, rmsg);

            LoginServerManager.Instance.Server.SendMessage(rmsg.userId, CmdNum.SC_Login, rmsg, bs.sender, LoginServerManager.Instance.sendTime.interval_1, LoginServerManager.Instance.sendTime.count_1,false);
        }
        private void OnLoginPro(MemoryStream ms, UInt64 userid)
        {
            LoginMsg.S2CLogin msg = new LoginMsg.S2CLogin();
            msg = ProtoBuf.Serializer.Deserialize<LoginMsg.S2CLogin>(ms);
            ms.Close();

            if (msg.userId == 0)
            {
                Global.Instance.ePopWindowState = Global.EPopWindowState.USER_LOGIN_ERROR; //登录失败
                return;
            }
            else
            {
                server.msgResend.RemoveMsg(ICmdNum.CmdNum.CS_Login);//停止重发
            }

            if (Global.Instance.gameState != Global.EGameState.Login)//非登录状态丢包
                return;

            //BaseActor _baseactor = ActorManager.Instance.GetActor(_userid);
            if (ActorManager.Instance.controlActor == null)
            {
                if (ActorManager.Instance.GetActor(userid) != null)
                {
                    Debug.LogError("角色列表未清空");
                    return;
                }

                ActorManager.Instance.controlActor = new BaseActor();//建立角色
                //ActorManager.Instance.AddActor(ActorManager.Instance.controlActor);
                ActorManager.Instance.controlActor.info.guid = msg.userId;//读取角色数据
                ActorManager.Instance.controlActor.info.name = msg.name;
                ActorManager.Instance.controlActor.info.hp = msg.hp;               
                ActorManager.Instance.controlActor.info.type = (BaseActor.Type)msg.type;

                //枪信息
                ActorManager.Instance.controlActor.info.RemoveAllGun();
                for (int i = 0; i < msg.GunInfo.Count; i++)
                {
                    Gun gun = new Gun();
                    ActorManager.Instance.controlActor.info.m_GunList.Add(gun);
                    //服务器传递的信息
                    gun.info.id = msg.GunInfo[i].id;
                    gun.info.use = msg.GunInfo[i].use;
                    gun.info.experience = msg.GunInfo[i].experience;
                    gun.info.quality = (Gun.Quality)msg.GunInfo[i].quality;
                    gun.info.count = msg.GunInfo[i].count;
                    gun.info.bullet_quality = msg.GunInfo[i].bullet_quality;
                    gun.info.caliber = msg.GunInfo[i].caliber;
                    gun.info.speed = msg.GunInfo[i].speed;
                    gun.info.frequency = msg.GunInfo[i].frequency;
                    gun.info.accurate = msg.GunInfo[i].accurate;
                    gun.info.range = msg.GunInfo[i].range;
                    gun.info.recoil = msg.GunInfo[i].recoil;
                    gun.info.weight = msg.GunInfo[i].weight;
                    gun.info.swap_speed = msg.GunInfo[i].swap_speed;
                    gun.info.aim_scale = msg.GunInfo[i].aim_scale;

                    //读取配置数据
                    deploy.GUN_INFO guninfo = GameConfig.Instance.gunInfoData.GetData(gun.info.id);
                    gun.info.type = (Gun.Type)Enum.Parse(typeof(Gun.Type), guninfo.type);//字符串转枚举
                    gun.info.num = (Gun.Num)Enum.Parse(typeof(Gun.Num), guninfo.num);//字符串转枚举
                    gun.info.name = guninfo.name;
                    gun.info.describe = guninfo.describe;                    
                }

                ActorManager.Instance.controlActor.info.money = msg.money;
                ActorManager.Instance.controlActor.info.diamonds = msg.diamonds;
                ActorManager.Instance.controlActor.info.experience = msg.experience;
                ActorManager.Instance.controlActor.info.integral = msg.integral;
                ActorManager.Instance.controlActor.info.experience_rank = msg.experience_rank;
                ActorManager.Instance.controlActor.info.integral_rank = msg.integral_rank;
                ActorManager.Instance.controlActor.info.modelType = msg.modelType;

                Global.Instance.gameState = Global.EGameState.Main;
                Global.Instance.LoadMainUILevel();
            }
            else
            {
                Debug.Log("重复登录返回消息");
            }
        }