Commit Graph

28 Commits

Author SHA1 Message Date
Jonas bec5df7e88 Add turn tracking and enforce turn order
Introduce CurrentTurn to Game (default 1) and expose it via GameInformationDto. Update GameManager to include CurrentTurn in the GameInformation payload, validate that a player can only Drop when it is their turn, and toggle CurrentTurn between 1 and 2 after a successful move. Also use a safe fallback (0) when game is null.
2026-03-12 23:20:05 +01:00
Jonas 3cb2a6c159 Auto-delete ended games after delay
Schedule game removal after a short delay when a game ends. Adds ScheduleGameDeletion which starts a background task, waits (5s), checks the repository for the game and its Ended state, destroys it, and notifies the hub with "GameDestroyed". Calls to ScheduleGameDeletion were added after Win, Draw, and PlayerDisconnected; PlayerDisconnected no longer returns the SendAsync task but returns a completed task after scheduling deletion.
2026-03-12 23:20:05 +01:00
Jonas e8b45fa235 Add column drop, game info DTO, and disconnect
Introduce column-based drop mechanics and game info transfer; add disconnect handling and related API/interface updates. GameField API renamed Place->Drop and PlaceResult->DropResult, added ColumnFull, IsFull, and updated drop logic to insert at lowest empty row. Game model now exposes Players, adds GetPlayerByTag and makes StartGame public. New GameInformationDto conveys game state and field. Hub methods updated: GameCreated->GameJoined, RequestGameInformation, Place now forwards to Drop, and OnDisconnectedAsync notifies GameManager. GameManager implements RequestGameInformation, Drop (validates moves, broadcasts FieldUpdated and GameEnded on win/draw), improved JoinGame logic to auto-start when two players join, and handles player disconnects. Repository and interface extended with GetOneByConnectionId. Also tightened SignalR timeouts in Program.
2026-03-12 23:20:05 +01:00
Jonas 955d1e18c6 Add player tags, game lifecycle and win checks
Additions and refactors across controllers, models, repo and services to support game lifecycle and win detection. Key changes:

- Models: Player now has PlayerTag; Game assigns tags, starts when 2 players join, exposes GetPlayerByConnectionId, StartGame and EndGame helpers.
- GameField: Implemented win-detection (CountInDirection, CheckLine, CheckForWin) and minor backing-field init.
- Repository/API: GameRepository.Create no longer accepts a Player (repo only creates games); minor variable cleanups; IGameRepository signature updated accordingly.
- Services: GameManager now injects IHubContext<GameHubSocket>, moves player-adding into manager (CreateGame), makes JoinGame async and notifies the SignalR group when a game starts, and adds a placeholder async Place method. Controller (GameHubSocket) also exposes a Place method stub to match the service API.

Motivation: separate responsibilities so repository only creates games, manager handles player joins and notifications, and add core game logic (player tagging and win checks) needed for gameplay. Place methods are added as placeholders for future move handling.
2026-03-12 23:20:05 +01:00
Jonas 85521f3b23 Return game ID+code; update hub and Player model
Change GameManager/CreateGame to return (gameId, gameCode) and Make JoinGame return the game Id (or null) instead of a bool. Update IGameManager signature accordingly. Refactor Hub methods to construct Player objects, accept Coordinates for game creation, use the manager results to add connections to groups and send GameCreated with GameId and GameCode, and handle join failures with an error message. Simplify Player class to use a primary-constructor style with property initialization; add necessary using directives.
2026-03-12 23:20:05 +01:00
Jonas ce52d1462f Add player list and wire repo/manager
Replace the nullable PlayerConnectionIds array with a private List<Player> inside Game and add AddPlayer/RemovePlayer methods to manage membership. Have GameRepository.Create attach the initial player to the newly created game. Implement GameManager.CreateGame and JoinGame to call the repository (using the injected gameRepository) — CreateGame returns the created game's code and JoinGame looks up the game and tries to add the player. Also update imports accordingly. These changes centralize player handling in the Game model and connect repository/manager flows to use it.
2026-03-12 23:20:05 +01:00
jonas 0e7bfb7241 Refactor GameRepository and GameManager architecture, introduce Player model, and update dependency registration in Program.cs. 2026-03-12 23:20:05 +01:00
jonas b967bd70eb Refactor and clean up codebase:
- Introduced `IGameRepository` interface and its implementation.
- Transitioned namespaces to `file-scoped` for consistency.
- Simplified class definitions, e.g., `Game` and `SixDigitInt`.
- Restructured `GameField` logic for improved readability and functionality.
- Fixed formatting issues in `API.csproj` and added a `using` directive in `Program.cs`.
2026-03-12 23:20:05 +01:00
jhim 5db7ac1676 Added Backend Classes and FUnctions for an working Game. But lacking Implementations 2026-03-12 23:20:05 +01:00
jonas 120c671dce Integrate SignalR for game session management and clean up unused local game logic. 2026-03-12 23:20:05 +01:00
jonas 306dacc300 Update Vite output path and remove redundant wwwroot configuration 2026-03-12 23:20:05 +01:00
jonas afa14d07c6 Remove IDE-specific configuration files and update .gitignore. 2026-03-12 23:20:05 +01:00
jonas 8eefc1a2b8 Configure API to serve SPA, integrate SignalR, and update build paths 2026-03-12 23:20:05 +01:00
jonas 3fa0455f1b Add GameController with SignalR functionality for joining games 2026-03-12 23:20:05 +01:00
jonas f98d9e79b2 Add StatusController, improve local game logic, and enable Swagger in API 2026-03-12 23:20:05 +01:00
jonas 7395b6d3bf Introduce LocalGame logic and integrate with LocalMode rendering. 2026-03-12 23:20:05 +01:00
jonas 13fdf97f5a - Rename and restructure components and assets for uniformity.
- Refactor `Field.vue` for better state management and event handling.
- Update path references for SVG assets.
- Add selection highlighting in game field with red and white arrows.
- Simplify and organize styles in game components.
- Minor updates to local mode game logic (`LocalMode.vue`).
2026-03-12 23:20:05 +01:00
jonas 2337c6b2db "Remove package-lock.json file." 2026-03-12 23:20:05 +01:00
jonas 0e90f70a92 "Remove package-lock.json file." 2026-03-12 23:20:05 +01:00
jhim a8879da715 better design and working setting cells 2026-03-12 23:20:05 +01:00
jhim 8e99bbca0e added a new site and a gamefield component 2026-03-12 23:20:05 +01:00
Jonas 4dfabb2e1e Claude/style homepage om t wo (#1)
* Style homepage with centered title and polished buttons

- Split title into two lines with uppercase styling and yellow highlight
- Use Roboto font with light/bold weight contrast for visual hierarchy
- Center buttons in a vertical flex layout with consistent spacing
- Add elevation shadow and hover scale animation to buttons
- Improve letter-spacing and font sizing for readability

https://claude.ai/code/session_01N9z7ADBGmszE5ZoAbVEp4f

* changed ' to "

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: jhim <jhim@d-velop.de>
2026-03-12 23:20:05 +01:00
jonas d39b06e3e9 Remove WeatherForecastController and update project file to clean up unused code. 2026-03-12 23:20:05 +01:00
jonas da6bb05126 Set app title, update Home, normalize lockfile
Change the app title in GUI/index.html to "4 Gewinnt" to reflect the project name. Apply updates to GUI/src/Home.vue (UI/logic adjustments). Regenerate/normalize GUI/package-lock.json alongside these changes.
2026-03-12 23:20:05 +01:00
jhim 4533bdf179 startseite 2026-03-12 23:20:05 +01:00
jhim 74f9f11b6d init vue and asp.net 2026-03-12 23:20:05 +01:00
jhim d886fa24a6 Add project files. 2026-02-06 08:29:28 +01:00
jhim afcc34f5cf Add .gitattributes, .gitignore, and README.md. 2026-02-06 08:29:26 +01:00