diff --git a/Assets/NetworkLobbyClient/Runtime/LobbyClient.dll b/Assets/NetworkLobbyClient/Runtime/LobbyClient.dll index 8956247..623717f 100644 Binary files a/Assets/NetworkLobbyClient/Runtime/LobbyClient.dll and b/Assets/NetworkLobbyClient/Runtime/LobbyClient.dll differ diff --git a/Assets/NetworkLobbyClient/Runtime/LobbyServerDto.dll b/Assets/NetworkLobbyClient/Runtime/LobbyServerDto.dll index 7b5acc4..15ef445 100644 Binary files a/Assets/NetworkLobbyClient/Runtime/LobbyServerDto.dll and b/Assets/NetworkLobbyClient/Runtime/LobbyServerDto.dll differ diff --git a/LobbyClient/LobbyClient.cs b/LobbyClient/LobbyClient.cs index c5ed145..5b05b42 100644 --- a/LobbyClient/LobbyClient.cs +++ b/LobbyClient/LobbyClient.cs @@ -380,7 +380,7 @@ namespace Lobbies private void TcpClient_DataReceived(int dataLength, Memory data) { try - { + { if (dataLength > 0) { switch (LobbyMessageIdentifier.ReadLobbyMessageIdentifier(data.Span)) @@ -428,6 +428,7 @@ namespace Lobbies case LobbyHostInfo.TypeId: { var lobbyHostInfo = LobbyHostInfo.Deserialize(data.Span); + if (lobbyHostInfo != null) { events.Enqueue(new LobbyClientEvent { EventType = LobbyClientEventTypes.LobbyHostInfo, EventData = lobbyHostInfo }); diff --git a/LobbyClientTest/Program.cs b/LobbyClientTest/Program.cs index 761f155..35ac64d 100644 --- a/LobbyClientTest/Program.cs +++ b/LobbyClientTest/Program.cs @@ -29,6 +29,26 @@ _ = Task.Run(() => { switch (lobbyEvent.EventType) { + case LobbyClientEventTypes.LobbyJoinFailed: + { + var lobbyJoinFailReason = lobbyEvent.EventData as LobbyJoinFailReason; + var p = Console.GetCursorPosition(); + Console.SetCursorPosition(0, p.Top); + switch (lobbyJoinFailReason!.Reason) + { + case LobbyJoinFailReason.FailReasons.WrongPassword: + Console.WriteLine("Lobby password wrong!"); + break; + case LobbyJoinFailReason.FailReasons.LobbyFull: + Console.WriteLine("Lobby full!"); + break; + case LobbyJoinFailReason.FailReasons.LobbyNotFound: + Console.WriteLine("Lobby not found!"); + break; + } + Console.Write(">"); + } + break; case LobbyClientEventTypes.Connected: { connected = true; @@ -210,7 +230,7 @@ while (running) else { Console.WriteLine("Hosting game ..."); - lobbyClient.HostLobby(GameGuids.NFS, "Hallo, Welt!", 1, 8, null, myPort); + lobbyClient.HostLobby(GameGuids.NFS, "Hallo, Welt!", 1, 8, "haher", myPort); fakeGameHost.isHost = true; } } @@ -234,7 +254,15 @@ while (running) var firstLobby = openLobbies.FirstOrDefault(); if (firstLobby != null) { - lobbyClient.RequestLobbyHostInfo(firstLobby.Id, null); + if(firstLobby.PasswordProtected) + { + Console.WriteLine("Please enter password: "); + Console.Write(">"); + var password = Console.ReadLine(); + lobbyClient.RequestLobbyHostInfo(firstLobby.Id, password); + } + else + lobbyClient.RequestLobbyHostInfo(firstLobby.Id, null); } else { diff --git a/LobbyServerDto/LobbyRequestHostInfo.cs b/LobbyServerDto/LobbyRequestHostInfo.cs index 656487c..fad0246 100644 --- a/LobbyServerDto/LobbyRequestHostInfo.cs +++ b/LobbyServerDto/LobbyRequestHostInfo.cs @@ -15,7 +15,7 @@ namespace LobbyServerDto /// /// Hash of the password if the lobby requires one /// - [MaxLength(26)] + [MaxLength(64)] public byte[]? PasswordHash { get; set; } } } \ No newline at end of file diff --git a/LobbyServerDto/LobbyRequestNatPunch.cs b/LobbyServerDto/LobbyRequestNatPunch.cs index 4affca6..8c85218 100644 --- a/LobbyServerDto/LobbyRequestNatPunch.cs +++ b/LobbyServerDto/LobbyRequestNatPunch.cs @@ -15,7 +15,7 @@ namespace LobbyServerDto /// /// Password hash if the lobby is password protected /// - [MaxLength(26)] + [MaxLength(64)] public byte[]? PasswordHash { get; set; } /// /// Our external ip