From 357449025a313bad3484596f1c2f8413ccc288a2 Mon Sep 17 00:00:00 2001 From: Jonas Date: Sun, 8 Mar 2026 20:02:29 +0100 Subject: [PATCH] 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. --- API/Services/GameManager/GameManager.cs | 2 +- GUI/src/components/CreateOrJoinMenu.vue | 22 ++++ GUI/src/components/GameCreationMenu.vue | 101 +++++++++--------- GUI/src/components/GameEndedMenu.vue | 54 +++++----- GUI/src/routes/LocalMode.vue | 21 ++-- GUI/src/routes/OnlineMode.vue | 34 +++++- GUI/src/scripts/logic/localMode/LocalGame.ts | 2 +- .../scripts/logic/onlineMode/OnlineGame.ts | 16 +++ 8 files changed, 155 insertions(+), 97 deletions(-) create mode 100644 GUI/src/components/CreateOrJoinMenu.vue create mode 100644 GUI/src/scripts/logic/onlineMode/OnlineGame.ts diff --git a/API/Services/GameManager/GameManager.cs b/API/Services/GameManager/GameManager.cs index 168517e..291c4e3 100644 --- a/API/Services/GameManager/GameManager.cs +++ b/API/Services/GameManager/GameManager.cs @@ -66,7 +66,7 @@ public class GameManager(IGameRepository gameRepository, IHubContext +defineEmits(['createGame', 'joinGame']); + + + + + diff --git a/GUI/src/components/GameCreationMenu.vue b/GUI/src/components/GameCreationMenu.vue index b3d9996..667d5c5 100644 --- a/GUI/src/components/GameCreationMenu.vue +++ b/GUI/src/components/GameCreationMenu.vue @@ -15,58 +15,57 @@ function gameFieldPreset(x: number, y: number) { \ No newline at end of file + diff --git a/GUI/src/routes/LocalMode.vue b/GUI/src/routes/LocalMode.vue index f25d338..3b88874 100644 --- a/GUI/src/routes/LocalMode.vue +++ b/GUI/src/routes/LocalMode.vue @@ -49,22 +49,17 @@ async function restart() {