Fix unessesary memory allocation

main
Thomas Woischnig 2026-04-13 05:50:52 +02:00
parent 5cd58eeec5
commit 57855e80e3
2 changed files with 4 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "com.incobyte.lobbyclient", "name": "com.incobyte.lobbyclient",
"version": "1.0.4", "version": "1.0.5",
"displayName": "Game Lobby Client", "displayName": "Game Lobby Client",
"description": "Provides a client for the game lobby server to list and join lobbies", "description": "Provides a client for the game lobby server to list and join lobbies",
"unity": "2022.3", "unity": "2022.3",

View File

@ -56,24 +56,9 @@ namespace Lobbies
} }
} }
public IEnumerable<LobbyClientEvent> ReadEvents(int maxEvents) public bool TryReadEvent(out LobbyClientEvent result)
{ {
if (events.Count > 0) return events.TryDequeue(out result);
{
maxEvents = Math.Min(maxEvents, events.Count);
while (maxEvents > 0)
{
if(events.TryDequeue(out var _event))
{
yield return _event;
}
else
{
break;
}
}
}
} }
public void HostLobby(Guid gameId, string name, int gameMode, int maxPlayerCount, string? password, int port) public void HostLobby(Guid gameId, string name, int gameMode, int maxPlayerCount, string? password, int port)