Ejemplo n.º 1
0
        /// <summary>
        /// 接收消息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="msg"></param>
        public void Receive(ClientPeer client, NetMsg msg)
        {
            Console.WriteLine("--接收消息--" + msg.opCode + "   " + msg.subCode);
            switch (msg.opCode)
            {
            case OpCode.Account:
                accountHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Match:
                matchHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Chat:
                chatHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Fight:
                fightHandler.Receive(client, msg.subCode, msg.value);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 接收消息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="msg"></param>
        public void Receive(ClientPeer client, NetMsg msg)
        {
            // 分发消息
            switch (msg.opCode)
            {
            case OpCode.Account:
                accountHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Match:
                matchHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Chat:
                chatHandler.Receive(client, msg.subCode, msg.value);
                break;

            case OpCode.Fight:
                fightHandler.Receive(client, msg.subCode, msg.value);
                break;

            default:
                break;
            }
        }