示例#1
1
        /// 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);
        }
示例#2
0
        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;
        }
示例#3
0
        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);
        }
示例#4
0
        public bool Send(Packet packet, int channel = 0)
        {
            var conn = _clientInstance.ServerConnection;

            if (conn == null)
            {
                return false;
            }

            return Send(packet, (NetNode)conn, channel);
        }