示例#1
0
        public void OnMessageReceived(UserToken token, byte[] message)
        {
            SocketModel sm = mDecode(message);

            if (sm != null)
            {
                GameFW.Utility.Tools.debuger.Log("收到了消息, 类型为:" + sm.type + ", 命令为:" + sm.command);
                switch (sm.type)
                {
                case Protocol.Protocol.TYPE_USER:
                    userHandler.OnMessageReceived(token, sm);
                    break;

                case Protocol.Protocol.TYPE_SELECT:
                    selectHandler.OnMessageReceived(token, sm);
                    break;

                case Protocol.Protocol.TYPE_MATCH:
                    matchHandler.OnMessageReceived(token, sm);
                    break;

                case Protocol.Protocol.TYPE_LOGIN:
                    loginHandler.OnMessageReceived(token, sm);
                    break;

                case Protocol.Protocol.TYPE_FIGHT:
                    fightHandler.OnMessageReceived(token, sm);
                    break;

                case Protocol.Protocol.TYPE_TIME:
                    timeHandler.OnMessageReceived(token, sm);
                    break;

                default:
                    break;
                }
            }
        }