private void LoadMessageAttribute()
        {
            Type[] types = _systemManager.GetTypes;
            foreach (var item in types)
            {
                //get  messagehandler
                object[] attribute = item.GetCustomAttributes(typeof(MessageHandlerAttribute), false);
                if (attribute.Length > 0 && !item.IsAbstract && item.BaseType == typeof(MessageHandlerBase))
                {
                    MessageHandlerAttribute msHanderAttibute = (MessageHandlerAttribute)attribute[0];
                    if (!_messageHandler.ContainsKey(msHanderAttibute.TypeMessage))
                    {
                        _messageHandler[msHanderAttibute.TypeMessage] = new List <MessageHandlerBase>();
                    }
                    _messageHandler[msHanderAttibute.TypeMessage].Add((MessageHandlerBase)Activator.CreateInstance(item));
                }

                //get message
                attribute = item.GetCustomAttributes(typeof(MessageAttribute), false);
                if (attribute.Length > 0 && !item.IsAbstract)
                {
                    MessageAttribute msAttibute = (MessageAttribute)attribute[0];
                    _messageCodeType[msAttibute.TypeCode] = item;
                }
            }
        }
        public void SendMessage(object message, IPEndPoint endPoint)
        {
            byte[] messageData = _protobufPacker.ToBytes(message);

            object[] attribute = message.GetType().GetCustomAttributes(typeof(MessageAttribute), false);
            if (attribute.Length <= 0)
            {
                throw new GamekException("class not found MessageAttribute");
            }
            MessageAttribute mgAttribute = (MessageAttribute)attribute[0];

            SendMessage(mgAttribute.TypeCode, messageData, endPoint);
        }