Fix unessesary memory allocation
This commit is contained in:
1 parent
5cd58eeec5
commit
57855e80e3
2 files changed
+3
-18
No files matched your search
@@ -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",
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in new issue
Block a user