本文整理汇总了C#中Lidgren.Network.NetOutgoingMessage.PeekDataBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# NetOutgoingMessage.PeekDataBuffer方法的具体用法?C# NetOutgoingMessage.PeekDataBuffer怎么用?C# NetOutgoingMessage.PeekDataBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lidgren.Network.NetOutgoingMessage
的用法示例。
在下文中一共展示了NetOutgoingMessage.PeekDataBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compress
public static NetOutgoingMessage Compress(NetOutgoingMessage msg)
{
msg.WritePadBits();
byte[] input = msg.PeekDataBuffer();
byte[] output = new byte[input.Length*2];
int outlength = ZipCompressor.Instance.Compress(input, msg.LengthBytes, output);
msg.EnsureBufferSize(outlength*8);
input = msg.PeekDataBuffer();
Array.Copy(output, input, outlength);
msg.LengthBytes = outlength;
msg.LengthBits = outlength * 8;
return msg;
}
示例2: SendNot
public virtual void SendNot(NetOutgoingMessage m, IPEndPoint ep)
{
if (server.ConnectionsCount == 0 && Root.Instance.Recorder == null)
return;
if (ep == null)
throw new Exception("ep==null");
if (Root.Instance.Recorder != null)
{
byte[] buf = m.PeekDataBuffer();
Root.Instance.Recorder.WritePacket((int)(Root.Instance.Time * 1000), buf, buf.Length);
}
List<NetConnection> list = new List<NetConnection>();
foreach (NetConnection s in Clients)
{
if (s != null)
{
if (ep.ToString() != s.RemoteEndpoint.ToString())
list.Add(s);
}
}
server.SendMessage(compress?NetCompressor.Compress(m):m, list, NetDeliveryMethod.Unreliable, 0);
}