Added better GPS handling, Improved test mode, Fixed naming of players not being broadcast until a new HelloClient, Fixed lobby restarts, Fixed task handling

This commit is contained in:
Bandwidth
2026-04-27 23:18:13 +02:00
parent d886f97e14
commit 207f997254
8 changed files with 1175 additions and 77 deletions

View File

@@ -533,6 +533,11 @@ public class GameClient : IDisposable
public void CreateLobby(Position? center = null, int impostorCount = 1, int taskCount = 5, string? password = null, double playAreaRadius = 500, GameSettingsOverrides? settings = null)
{
// DisplayName is sent on every CreateLobby/JoinLobby so the server
// picks up the live nickname (typed into the input field after the
// ClientHello handshake fired). Without this the server uses the
// ClientHello-time name, which is the GameManager prefab default
// for any user who immediately created/joined a lobby.
Send(new CreateLobby
{
PlayAreaCenter = center,
@@ -540,16 +545,18 @@ public class GameClient : IDisposable
ImpostorCount = impostorCount,
TaskCount = taskCount,
Password = password,
Settings = settings
Settings = settings,
DisplayName = DisplayName
});
}
public void JoinLobby(string joinCode, string? password = null)
{
Send(new JoinLobby
{
JoinCode = joinCode.ToUpperInvariant(),
Password = password
Password = password,
DisplayName = DisplayName
});
}

View File

@@ -197,6 +197,16 @@ public class CreateLobby : Message
/// </summary>
[JsonProperty("settings")]
public GameSettingsOverrides? Settings { get; set; }
/// <summary>
/// Optional. Live host display name from the nickname input field at
/// the moment of CreateLobby. ClientHello-time name is stale because
/// the handshake fires before the user has typed anything; this lets
/// the server pick up the freshly-typed name without a separate
/// rename round-trip.
/// </summary>
[JsonProperty("displayName")]
public string? DisplayName { get; set; }
}
public class CreateLobbyResponse : Message
@@ -222,12 +232,19 @@ public class CreateLobbyResponse : Message
public class JoinLobby : Message
{
public override string Type => "JoinLobby";
[JsonProperty("joinCode")]
public string JoinCode { get; set; } = "";
[JsonProperty("password")]
public string? Password { get; set; }
/// <summary>
/// Optional. Live joiner display name from the nickname input field
/// at the moment of Join. See CreateLobby.DisplayName for rationale.
/// </summary>
[JsonProperty("displayName")]
public string? DisplayName { get; set; }
}
public class JoinLobbyResponse : Message