Add JoinMenu and join error handling
Add a new JoinMenu.vue component to provide a UI for joining existing games (emits a "join" event and offers Cancel/Join buttons). Improve UX by adding spacing to GameCreationMenu.vue header. Update OnlineMode.vue to import GameCreationMenu. In the API, send a client-side error message when adding a player fails (GameManager.cs now notifies the player's connection with "Spiel Existiert nicht!" before returning null) so users receive immediate feedback when a join attempt is invalid.
This commit is contained in:
@@ -21,7 +21,11 @@ public class GameManager(IGameRepository gameRepository, IHubContext<GameHubSock
|
||||
|
||||
var success = game != null && game.State == GameState.Lobby && game.AddPlayer(player);
|
||||
|
||||
if (!success) return null;
|
||||
if (!success)
|
||||
{
|
||||
await hubContext.Clients.Client(player.ConnectionId).SendAsync("Error", "Spiel Existiert nicht!");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (game.Players.Count == 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user