Exemple #1
0
        /// <summary>
        /// 登录处理
        /// </summary>
        /// <param name="acc"></param>
        /// <param name="pwd"></param>
        private void OnLogin(MobaClient client, string acc, string pwd)
        {
            //无效检查
            if (acc == null || pwd == null)
            {
                return;
            }

            if (cache.IsOnline(acc))
            {
                this.Send(client, OpCode.AccountCode, OpAccount.Login, -1, "玩家在线");
                return;
            }
            //验证账号密码是否合法
            bool res = cache.Match(acc, pwd);

            if (res == true)
            {
                cache.OnLine(acc, client);
                this.Send(client, OpCode.AccountCode, OpAccount.Login, 0, "登录成功");
            }
            else
            {
                this.Send(client, OpCode.AccountCode, OpAccount.Login, -2, "账号密码错误");
            }
        }
Exemple #2
0
 private int Login(UserToken token, string username, string password)
 {
     if (username == null ||
         password == null ||
         username.Equals("") ||
         password.Equals("") ||
         !cacheInstance.HasAccount(username) ||
         cacheInstance.IsOnline(username) ||
         !cacheInstance.Match(username, password))
     {
         return(Protocol.COMMAND_LOGIN_FAIL);
     }
     cacheInstance.Online(token, username);
     return(Protocol.COMMAND_LOGIN_SUCCESS);
 }
Exemple #3
0
 /// <summary>
 /// 登录处理
 /// </summary>
 /// <param name="acc"></param>
 /// <param name="pwd"></param>
 private void onLogin(MobaClient client, string acc, string pwd)
 {
     if (acc == null || pwd == null)
     {
         return;
     }
     //验证在线...
     if (cache.IsOnline(acc))
     {
         this.Send(client, OpCode.AccountCode, OpAccount.Login, -1, "玩家在线");
         return;
     }
     if (cache.Match(acc, pwd))
     {
         cache.Online(acc, client);
         this.Send(client, OpCode.AccountCode, OpAccount.Login, 0, "登录成功");
     }
     else
     {
         this.Send(client, OpCode.AccountCode, OpAccount.Login, -2, "账号或密码错误");
     }
 }
 private void OnLogin(MOBAClient client, string account, string password)
 {
     //无效检测
     if (account == null || password == null)
     {
         return;
     }
     //验证在线
     if (accountCache.IsOnLine(account))
     {
         Send(client, OperationCode.AccountCode, OpAccount.Login, -1, "玩家在线");
         return;
     }
     if (accountCache.Match(account, password))
     {
         accountCache.OnLineClient(account, client);
         Send(client, OperationCode.AccountCode, OpAccount.Login, 0, "登录成功");
     }
     else
     {
         Send(client, OperationCode.AccountCode, OpAccount.Login, -2, "账号或密码错误");
     }
 }
Exemple #5
0
        /// <summary>
        /// 登录处理
        /// </summary>
        /// <param name="acc"></param>
        /// <param name="pwd"></param>
        private void onLogin(MobaClient client, string acc, string pwd)
        {
            if (string.IsNullOrEmpty(acc) || string.IsNullOrEmpty(pwd))
            {
                return;
            }
            //验证在线...
            if (cache.isOnline(acc))
            {
                Send(client, OpCode.AccountCode, OpAccount.Login, -1, "玩家在线");
                return;
            }
            bool res = cache.Match(acc, pwd);

            if (res)
            {
                cache.Online(acc, client);
                Send(client, OpCode.AccountCode, OpAccount.Login, 0, "登录成功");
            }
            else
            {
                Send(client, OpCode.AccountCode, OpAccount.Login, -2, "账号或密码错误");
            }
        }