diff --git a/API/Services/GameManager/GameManager.cs b/API/Services/GameManager/GameManager.cs index 472209d..fb3a54d 100644 --- a/API/Services/GameManager/GameManager.cs +++ b/API/Services/GameManager/GameManager.cs @@ -77,7 +77,16 @@ public class GameManager(IGameRepository gameRepository, IHubContext { console.log('Game started for player 1', gameInfo); - this.gameStarted(gameInfo); + this.updateState(gameInfo); }; - this.player1.onFieldUpdated = (currentField: number[][]) => { + this.player1.onFieldUpdated = (currentState: GameInformationDto) => { if (this.gameState) { - this.gameState.currentField = currentField; + this.gameState = currentState; this.onGameStateChanged?.(this.gameState); } }; @@ -48,7 +48,7 @@ class LocalGame { await this.player1.createGame(this._settings.fieldSize); } - async gameStarted(gameInfo: GameInformationDto) { + async updateState(gameInfo: GameInformationDto) { this.gameState = gameInfo; this.onGameStateChanged?.(this.gameState); } diff --git a/GUI/src/scripts/logic/signalR/GameConnection.ts b/GUI/src/scripts/logic/signalR/GameConnection.ts index 221e6a2..e9ff091 100644 --- a/GUI/src/scripts/logic/signalR/GameConnection.ts +++ b/GUI/src/scripts/logic/signalR/GameConnection.ts @@ -33,7 +33,7 @@ class GameConnection { public onGameJoined?: (gameIdentifier: GameIdentifier) => void; public onGameStarted?: (gameInfo: GameInformationDto) => void; public onGameInformation?: (gameInfo: GameInformationDto) => void; - public onFieldUpdated?: (currentField: number[][]) => void; + public onFieldUpdated?: (currentField: GameInformationDto) => void; public onGameEnded?: (gameEndedInfo: GameEndedDto) => void; public onError?: (error: string) => void; public onGameDestroyed?: () => void; @@ -61,8 +61,8 @@ class GameConnection { this.onGameInformation?.(payload); }); - this.connection.on('FieldUpdated', (currentField: number[][]) => { - this.onFieldUpdated?.(currentField); + this.connection.on('FieldUpdated', (payload: GameInformationDto) => { + this.onFieldUpdated?.(payload); }); this.connection.on('GameEnded', (payload: GameEndedDto) => {