Add GameController with SignalR functionality for joining games
This commit is contained in:
+4
-1
@@ -360,4 +360,7 @@ MigrationBackup/
|
|||||||
.ionide/
|
.ionide/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# ai
|
||||||
|
.claude
|
||||||
Generated
+17
-4
@@ -9,10 +9,9 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="55603b38-3b47-4a5f-808e-ac484b0d090b" name="Changes" comment="">
|
<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/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>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -51,6 +50,9 @@
|
|||||||
"associatedIndex": 1
|
"associatedIndex": 1
|
||||||
}</component>
|
}</component>
|
||||||
<component name="ProjectId" id="39wILsse3VNcbmjm0D2fezayV6M" />
|
<component name="ProjectId" id="39wILsse3VNcbmjm0D2fezayV6M" />
|
||||||
|
<component name="ProjectLevelVcsManager">
|
||||||
|
<ConfirmationsSetting value="2" id="Add" />
|
||||||
|
</component>
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
@@ -124,8 +126,17 @@
|
|||||||
<workItem from="1771607712379" duration="87000" />
|
<workItem from="1771607712379" duration="87000" />
|
||||||
<workItem from="1771607816150" duration="554000" />
|
<workItem from="1771607816150" duration="554000" />
|
||||||
<workItem from="1771608705474" duration="719000" />
|
<workItem from="1771608705474" duration="719000" />
|
||||||
<workItem from="1771782531789" duration="745000" />
|
<workItem from="1771782531789" duration="1457000" />
|
||||||
</task>
|
</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 />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -146,6 +157,8 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
<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>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
|||||||
@@ -11,4 +11,10 @@
|
|||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
<Folder Include="Repository\" />
|
||||||
|
<Folder Include="Services\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user