public bool ClientSend(int channelId, ArraySegment <byte> data)
 {
     // ReSharper disable once ConvertIfStatementToReturnStatement
     if (channelId < channels.Length)
     {
         return(LiteNetLib4MirrorClient.Send(channels[channelId], data.Array, data.Offset, data.Count, (byte)channelId));
     }
     return(LiteNetLib4MirrorClient.Send(channels[0], data.Array, data.Offset, data.Count, 0));
 }
        public override bool ClientSend(int channelId, byte[] data)
        {
            // ReSharper disable once ConvertIfStatementToReturnStatement
            if (channelId < channels.Length)
            {
                return(LiteNetLib4MirrorClient.Send(channels[channelId], data, 0, data.Length, (byte)channelId));
            }

            return(LiteNetLib4MirrorClient.Send(channels[0], data, 0, data.Length, 0));
        }
        public override bool ClientSend(int channelId, NetworkWriter data)
        {
            try
            {
                ArraySegment <byte> bytes = data.ToArraySegment();
                // ReSharper disable once ConvertIfStatementToReturnStatement
                if (channelId < channels.Length)
                {
                    return(LiteNetLib4MirrorClient.Send(channels[channelId], bytes.Array, bytes.Offset, bytes.Count, (byte)channelId));
                }

                return(LiteNetLib4MirrorClient.Send(channels[0], bytes.Array, bytes.Offset, bytes.Count, 0));
            }
            finally
            {
                NetworkWriterPool.Recycle(data);
            }
        }
 public bool ClientSend(int channelId, ArraySegment <byte> data)
 {
     return(LiteNetLib4MirrorClient.Send(channels[channelId], data.Array, data.Offset, data.Count, (byte)channelId));
 }
 public override bool ClientSend(int channelId, byte[] data)
 {
     return(LiteNetLib4MirrorClient.Send(channels[channelId], data, 0, data.Length, (byte)channelId));
 }
예제 #6
0
        public override void ClientSend(int channelId, ArraySegment <byte> data)
        {
            byte channel = (byte)(channelId < channels.Length ? channelId : 0);

            LiteNetLib4MirrorClient.Send(channels[0], data.Array, data.Offset, data.Count, channel);
        }