Add GameController with SignalR functionality for joining games

This commit is contained in:
2026-02-22 19:17:18 +01:00
committed by Jonas
parent f98d9e79b2
commit 3fa0455f1b
4 changed files with 43 additions and 5 deletions
+3
View File
@@ -361,3 +361,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# ai
.claude
+17 -4
View File
@@ -9,10 +9,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="55603b38-3b47-4a5f-808e-ac484b0d090b" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/API/Controllers/StatusController.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/API/Controllers/GameController.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.4Gewinnt/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.4Gewinnt/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/API/API.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/API/API.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/API/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/API/Program.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GUI/src/scripts/logic/localMode/LocalGame.ts" beforeDir="false" afterPath="$PROJECT_DIR$/GUI/src/scripts/logic/localMode/LocalGame.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -51,6 +50,9 @@
&quot;associatedIndex&quot;: 1
}</component>
<component name="ProjectId" id="39wILsse3VNcbmjm0D2fezayV6M" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
@@ -124,8 +126,17 @@
<workItem from="1771607712379" duration="87000" />
<workItem from="1771607816150" duration="554000" />
<workItem from="1771608705474" duration="719000" />
<workItem from="1771782531789" duration="745000" />
<workItem from="1771782531789" duration="1457000" />
</task>
<task id="LOCAL-00001" summary="Add StatusController, improve local game logic, and enable Swagger in API">
<option name="closed" value="true" />
<created>1771783305542</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1771783305542</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -146,6 +157,8 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Add StatusController, improve local game logic, and enable Swagger in API" />
<option name="LAST_COMMIT_MESSAGE" value="Add StatusController, improve local game logic, and enable Swagger in API" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
+6
View File
@@ -11,4 +11,10 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="Repository\" />
<Folder Include="Services\" />
</ItemGroup>
</Project>
+16
View File
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.SignalR;
namespace API.Controllers;
public class GameController : Hub
{
public async Task JoinGame(string gameId, string playerName)
{
await Groups.AddToGroupAsync(Context.ConnectionId, gameId);
await Clients.Group(gameId).SendAsync("PlayerJoined", new
{
ConnectionId = Context.ConnectionId,
PlayerName = playerName
});
}
}