feat(casino): initial roulette version#28
Merged
Conversation
- casino-service.csproj targeting net10.0 with JWT bearer - Program.cs: ASP.NET Core with SignalR, JWT cookie auth, /api/lobbies endpoint - Models: GameSession, PlayerSeat, SessionState - Games/IGameEngine: plugin interface (CreateInitialState, ApplyAction, GetPublicState, CanStart) with GameAction + GameActionResult DTOs - Games/RussianRoulette: RussianRouletteSettings, RussianRouletteState, RussianRouletteEngine — spin-once cylinder, click/bang resolution - Services/SessionManager: thread-safe in-memory store, per-session locking, idle cleanup timer (lobbies 60 min, finished 10 min)
Real-time hub wired to SessionManager: - CreateLobby, JoinLobby, LeaveLobby (leader leaving dissolves lobby) - SetReady (joiners must accept terms before leader can start) - UpdateLobbySettings (leader only, deserialises to typed settings) - StartGame (leader only, delegates CanStart validation to engine) - PullTrigger → broadcasts TriggerResult + GameStateUpdated or SessionFinished - Reconnect support: rejoining mid-game replays GameStarted/SessionFinished - ApprovedOnly policy enforced via [Authorize] attribute
Stack: React 18 + Vite + react-router-dom + @microsoft/signalr
Uses @platform/ui-library (NavBar, Card, Button) from monorepo.
HashRouter avoids sub-path issues under /casino/ Caddy prefix.
CasinoHubContext: singleton SignalR connection with auto-reconnect,
exposes invoke() + on() to all pages.
Landing (/):
- Start Game → CreateLobby('russian-roulette') → /lobby/:id
- Join Game → fetches /api/lobbies, shows open lobby list
- Build Character → disabled placeholder
Lobby (/lobby/:id):
- Players list with per-player ready indicator
- Joiners: 'Accept Terms & Ready Up' toggle
- Leader: chamber count + stake display settings, Start Game button
(gated on canStart from server)
Game (/game/:id):
- Dispatches to RussianRouletteView by game type
- Click/Bang fullscreen overlay with fade animation
- Pull Trigger button shown only on your turn
- Finished screen with loser name + stake displayed
Build context is the monorepo root (same pattern as hello-world-dotnet-app) so the React frontend can resolve ui-library via file: reference. Stages: Node 22 builds React → .NET SDK publishes → .NET ASP.NET runtime. Serves on port 3007.
- docker-compose.yml: casino-service on port 3007, no DB dependency - Caddyfile: handle_path /casino/* with WebSocket headers, both host blocks - CI/CD: paths-filter + matrix entry (monorepo build context) + deploy pull - dashboard.html: Casino card pointing to /casino/
casino-service/wwwroot/ is build output (generated by Dockerfile) — ignore it the same way hello-world-dotnet-app/wwwroot/ is already ignored. Commit package-lock.json for reproducible frontend installs in CI.
out _ is ambiguous for the compiler here; out GameSession? _ resolves the CS1503 error and satisfies the nullable CS8601 warning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.