Пример #1
0
        public void OnMessageReceived(IntPtr data, int size, long messageNum, long recvTime, int channel)
        {
            var received     = _messagePackager.Unpack(data, size);
            var receivedType = received.GetType();

            if (!_packetConsumers.ContainsKey(receivedType))
            {
                return;
            }

            var consumer = _packetConsumers[receivedType];

            consumer.Consume(received);
        }
Пример #2
0
        public void OnMessageReceived(Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum,
                                      long recvTime, int channel)
        {
            var received     = _messagePackager.Unpack(data, size);
            var receivedType = received.GetType();

            if (!_packetConsumers.ContainsKey(receivedType))
            {
                return;
            }

            var consumer = _packetConsumers[receivedType];

            consumer.Consume(connection, received);

            _networkManager.RelayMessage(data, size, connection);
        }