public void Send(AsyncUserToken token, byte[] message, bool sendPlain = false)
 {
     if (!sendPlain)
     {
         message = MessageTransformer.PrepareMessageForSending(message);
     }
     token.Send(message);
 }
        public void Send(byte[] message, bool sendPlain = false)
        {
            if (!IsActive())
            {
                throw new InvalidOperationException("Socket client must run to send messge");
            }

            if (!sendPlain)
            {
                message = MessageTransformer.PrepareMessageForSending(message);
            }
            m_userToken.Send(message);
        }
Example #3
0
        public void Login(AsyncUserToken token, LoginReq loginReq)
        {
            //TODO:处理登录逻辑
            //检查是否有此账户
            //有:展示角色信息
            //没有:创建新角色
            string clientToken = loginReq.Token;
            bool   reLogin     = loginReq.Relogin;

            Console.WriteLine("LoginHandler -> LoginAck");

            //反回客户端创建新角色
            LoginAck loginAck = new LoginAck {
                CreateRole = true
            };

            token.Send(Cmd.Login, loginAck);
        }