Fix unessesary memory allocation
parent
5cd58eeec5
commit
57855e80e3
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.incobyte.lobbyclient",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"displayName": "Game Lobby Client",
|
||||
"description": "Provides a client for the game lobby server to list and join lobbies",
|
||||
"unity": "2022.3",
|
||||
|
|
|
|||
|
|
@ -56,26 +56,11 @@ namespace Lobbies
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerable<LobbyClientEvent> ReadEvents(int maxEvents)
|
||||
public bool TryReadEvent(out LobbyClientEvent result)
|
||||
{
|
||||
if (events.Count > 0)
|
||||
{
|
||||
maxEvents = Math.Min(maxEvents, events.Count);
|
||||
|
||||
while (maxEvents > 0)
|
||||
{
|
||||
if(events.TryDequeue(out var _event))
|
||||
{
|
||||
yield return _event;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return events.TryDequeue(out result);
|
||||
}
|
||||
|
||||
|
||||
public void HostLobby(Guid gameId, string name, int gameMode, int maxPlayerCount, string? password, int port)
|
||||
{
|
||||
udpEchoServer.Start(0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue