/// Assuming that excludeGroup is small public void Send(Packet packet, IList<NetNode> sendToList, IList<NetNode> excludeGroup, int channel = 0) { var msg = packet.SendMessage(this); var group = sendToList.Except(excludeGroup).Cast<NetConnection>().ToList(); if (group.Count == 0) return; Peer.SendMessage(msg, group, (Lidgren.Network.NetDeliveryMethod)packet.Method, channel); }
public bool Send(Packet packet, NetNode sendTo, int channel=0) { var msg = packet.SendMessage(this); NetSendResult result = Peer.SendMessage(msg, (NetConnection)sendTo, (Lidgren.Network.NetDeliveryMethod)packet.Method, channel); if (result == NetSendResult.Queued || result == NetSendResult.Sent) return true; else return false; }
public void Send(Packet packet, IList<NetNode> sendToList, NetNode excludeNode = null, int channel = 0) { var msg = packet.SendMessage(this); List<NetConnection> group = new List<NetConnection>(); foreach (var node in sendToList) { if (excludeNode == node) continue; group.Add(node); } if (group.Count == 0) return; Peer.SendMessage(msg, group, (Lidgren.Network.NetDeliveryMethod)packet.Method, channel); }