You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 15:16:33 +09:00
- ReadMessages() added to batch read messages. Image sample changed to use the new batch method.
This commit is contained in:
@@ -183,7 +183,29 @@ namespace Lidgren.Network
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read a pending message from any connection, if any
|
||||
/// </summary>
|
||||
public int ReadMessages(IList<NetIncomingMessage> addTo)
|
||||
{
|
||||
int added = m_releasedIncomingMessages.TryDrain(addTo);
|
||||
if (added > 0)
|
||||
{
|
||||
for (int i = 0; i < added; i++)
|
||||
{
|
||||
var index = addTo.Count - added + i;
|
||||
var nim = addTo[index];
|
||||
if (nim.MessageType == NetIncomingMessageType.StatusChanged)
|
||||
{
|
||||
NetConnectionStatus status = (NetConnectionStatus)nim.PeekByte();
|
||||
nim.SenderConnection.m_visibleStatus = status;
|
||||
}
|
||||
}
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
// send message immediately
|
||||
internal void SendLibrary(NetOutgoingMessage msg, IPEndPoint recipient)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user