コード例 #1
0
 /// <summary>
 /// 登陆
 /// </summary>
 private void OnClientLogin(PacketBase packet)
 {
     gs2c.ClientLogin msg = packet as gs2c.ClientLogin;
     if (msg.login_result == eLoginResult.E_SUCCESS)
     {
         ServerMsgSend.SendCharacterList(m_conn_idx);
     }
     else
     {
         Log.Error("登录错误:" + m_conn_idx);
     }
 }
コード例 #2
0
        /// <summary>
        /// 登陆
        /// </summary>
        private void OnClientLogin(PacketBase packet)
        {
            gs2c.ClientLogin msg = packet as gs2c.ClientLogin;
            if (msg.login_result == eLoginResult.E_SUCCESS)
            {
                EventController.TriggerEvent(ClientEventID.SHOW_STATUS, eFormStatusType.Account, "登录账号:" + ServerConfig.net_info.user_name);
                EventController.TriggerEvent(ClientEventID.SHOW_STATUS, eFormStatusType.Log, "登录成功");

                ServerMsgSend.SendCharacterList();
            }
            else
            {
                EventController.TriggerEvent(ClientEventID.SHOW_MESSAGE, "登录错误:" + msg.login_result, "错误");
                EventController.TriggerEvent(ClientEventID.SHOW_STATUS, eFormStatusType.Log, "登录失败");
            }
        }
コード例 #3
0
        /// <summary>
        /// 登录
        /// </summary>
        private void OnClientLogin(PacketBase packet)
        {
            ws2gs.ClientLogin msg = packet as ws2gs.ClientLogin;

            ///1.查询完成,确认这个过程中是否已经退出
            ClientSession session = ClientSessionManager.Instance.GetSession(msg.client_uid.conn_idx);

            if (session == null)
            {
                return;
            }

            ///2.修改状态
            if (msg.login_result == eLoginResult.E_SUCCESS)
            {
                //更新数据
                session.account_idx    = msg.account_idx;
                session.spid           = msg.spid;
                session.ss_uid         = msg.ss_uid;
                session.session_status = eSessionStatus.ALREADY_LOGIN;
                ClientSessionManager.Instance.AddSessionByAccount(session.account_idx, session.conn_idx);
            }
            else
            {
                session.session_status = eSessionStatus.LOGIN_FAILED;
                //是否超过验证次数:是的话直接踢号
                session.login_error_count += 1;
                if (session.login_error_count >= 5)
                {
                    ClientSessionManager.Instance.KickoutSession(session.conn_idx);
                    return;
                }
            }

            ///3.告诉客户端
            gs2c.ClientLogin rep_msg = PacketPools.Get(gs2c.msg.CLIENT_LOGIN) as gs2c.ClientLogin;
            rep_msg.login_result = msg.login_result;
            session.Send(rep_msg);
        }