From 243f83e6e8d3919f1a6f441777614b9e94dcea25 Mon Sep 17 00:00:00 2001 From: GrapeHuang Date: Tue, 3 Oct 2023 19:58:03 +0800 Subject: [PATCH] Modify Game.razor --- .../Gaas.GobbletGobblers.Client/Pages/Game.razor | 5 +++++ .../Controllers/GameController.cs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/Pages/Game.razor b/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/Pages/Game.razor index 1ae0162..64d243b 100644 --- a/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/Pages/Game.razor +++ b/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/Pages/Game.razor @@ -290,6 +290,11 @@ }); await hubConnection.StartAsync(); + + if (!string.IsNullOrEmpty(GameId)) + { + await hubConnection.SendAsync("JoinRoom", GameId.ToString(), name); + } } public bool IsConnected => !string.IsNullOrEmpty(name) && diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs index 7150bf0..bef9f97 100644 --- a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs +++ b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs @@ -49,7 +49,10 @@ public async Task GamesAsync(GameRequest request) PlayerId = new Guid(Convert.FromBase64String(request.Players[1].Id).Take(16).ToArray()), PlayerName = request.Players[1].Nickname }; - _ = await new JoinGameUseCase().ExecuteAsync(joinGameRequest, _repository); + + var game = await new JoinGameUseCase().ExecuteAsync(joinGameRequest, _repository); + + SendGameInfo(game.Id.ToString(), game); return new { url = $"https://oneheed.github.io/Gobblet-Gobblers/games/{createGameResponse.Id}" }; }