Commit Graph

4 Commits

Author SHA1 Message Date
jonas acae815a2a Wire up online game creation and show UI message
Add game creation lifecycle hooks and UI feedback for online games.

- OnlineGame: add onGameCreated and onGameJoinedFailed callbacks, wire player.onGameCreated to set gameId and invoke onGameCreated, and implement createGame to connect and create a game on the player connection. Small cleanup in drop().
- GameSettings: add optional message field to carry informational text to the UI.
- OnlineMode.vue: register handlers for onGameStateChanged, onGameEnded and onGameCreated to update the reactive state and transition to the end/waiting states; update createGame to call OnlineGame.createGame; adjust component rendering logic to include WaitingForOpponent state.
- GameCreationMenu.vue: hide form controls when a settings.message exists and display the message instead; minor layout class adjustments.

These changes enable creating a game, propagating the generated game code to the UI, and showing a message to the user while waiting for opponents.
2026-03-12 23:20:05 +01:00
jonas a5019fc27a 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.
2026-03-12 23:20:05 +01:00
jonas 357449025a Add online UI components and guard fix
Introduce Online mode UI and supporting logic, plus small UI/layout refinements and a backend guard fix.

- Add CreateOrJoinMenu component for choosing between creating or joining an online game.
- Add OnlineGame class (stub) to manage online-game connection callbacks.
- Update OnlineMode route to drive Create/Join flow and start creation state.
- Refactor GameCreationMenu and GameEndedMenu layout to center content and adjust spacing/emit names.
- Update LocalMode to use the refactored components for creating and end screens.
- Minor text tweak in LocalGame description.
- Fix GameManager guard to prevent processing player moves when the game is not in Running state (check current turn and game state before proceeding).

These changes wire up the initial online UI flow and tighten server-side validation to avoid processing moves outside a running game.
2026-03-12 23:20:05 +01:00
Jonas 0eed8020b8 Convert field to jagged arrays; add local SignalR UI
Change game field representation to jagged arrays (int[][]) for JSON/SignalR compatibility and add conversion helpers in GameManager. Make Coordinates JSON-serializable (constructor and JsonPropertyName attributes). Update GameHubSocket: validate field size, fix JoinGame parameter order/Group join, rename Place->Drop and send proper game id. Add client-side local play support: GameConnection SignalR client, LocalGame orchestration for two local players, and UI components (GameCreationMenu, Slider) plus GameSettings interface. Update LocalMode route to use the new creation UI and start local games. These changes enable reliable serialization over SignalR and a local two-player flow with a creation UI.
2026-03-12 23:20:05 +01:00