Fix unessesary memory allocation
parent
5cd58eeec5
commit
57855e80e3
|
|
@ -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,26 +56,11 @@ 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)
|
||||||
{
|
{
|
||||||
udpEchoServer.Start(0);
|
udpEchoServer.Start(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue