コード例 #1
0
        public void Send(Payload payload, DeliveryOptions deliveryOptions, Guid sessionId)
        {
            if (!TryGetPlayer(sessionId, out var player))
            {
                return;
            }

            _packetSender.AddPacket(player.Peer, deliveryOptions, BundleMessagePrefix, payload);
        }
コード例 #2
0
        public int Send(ISerializable message, DeliveryOptions deliveryOptions, IPeerSender peer)
        {
            var stream = _shamanStreamPool.Rent(message.GetType());

            try
            {
                _serializer.Serialize(message, stream);
                _packetSender.AddPacket(peer, deliveryOptions, new Payload(stream.GetBuffer()));
                return((int)stream.Length);
            }
            finally
            {
                _shamanStreamPool.Return(stream, message.GetType());
            }
        }