diff --git a/SlipItIn.Server.Tests/GameHubTests.cs b/SlipItIn.Server.Tests/GameHubTests.cs index 878d653..0b9ab7b 100644 --- a/SlipItIn.Server.Tests/GameHubTests.cs +++ b/SlipItIn.Server.Tests/GameHubTests.cs @@ -324,10 +324,12 @@ public class GameHubTests _gameService.Setup(s => s.SubmitSlipAsync(game.Id, player.Id, 55)).ReturnsAsync(true); _gameService.Setup(s => s.GetGameAsync(game.Id)).ReturnsAsync(new Game { Id = game.Id, LobbyCode = game.LobbyCode }); + _gameService.Setup(s => s.GetPlayerHandAsync(player.Id)).ReturnsAsync(new PlayerHandDto { PlayerId = player.Id }); await _hub.SubmitSlip(game.Id, player.Id, 55); _groupProxy.Verify(p => p.SendCoreAsync("SlipSubmitted", It.IsAny(), default), Times.Once); + _callerProxy.Verify(p => p.SendCoreAsync("PlayerHandUpdated", It.IsAny(), default), Times.Once); } [Fact] diff --git a/SlipItIn.Server/Hubs/GameHub.cs b/SlipItIn.Server/Hubs/GameHub.cs index d03a5b9..f76ac37 100644 --- a/SlipItIn.Server/Hubs/GameHub.cs +++ b/SlipItIn.Server/Hubs/GameHub.cs @@ -233,6 +233,7 @@ public class GameHub : Hub var result = await _gameService.SubmitSlipAsync(gameId, playerId, cardId); var game = await _gameService.GetGameAsync(gameId); + var hand = await _gameService.GetPlayerHandAsync(playerId); await Clients.Group(game.LobbyCode).SendAsync("SlipSubmitted", new { @@ -240,6 +241,7 @@ public class GameHub : Hub CardId = cardId, Success = result }); + await Clients.Caller.SendAsync("PlayerHandUpdated", hand); } catch (UnauthorizedAccessException ex) { diff --git a/SlipItIn/ViewModels/GameBoardViewModel.cs b/SlipItIn/ViewModels/GameBoardViewModel.cs index 4a333ba..2658c91 100644 --- a/SlipItIn/ViewModels/GameBoardViewModel.cs +++ b/SlipItIn/ViewModels/GameBoardViewModel.cs @@ -212,7 +212,7 @@ public partial class GameBoardViewModel : BaseViewModel, MainThread.BeginInvokeOnMainThread(() => { MyCards.Clear(); - foreach (var card in message.Value.Cards) + foreach (var card in message.Value.Cards.Where(card => !card.IsUsed)) MyCards.Add(card); }); } diff --git a/SlipItIn/Views/ChallengeNotificationOverlay.xaml b/SlipItIn/Views/ChallengeNotificationOverlay.xaml index 1bf75a9..f7e5ea2 100644 --- a/SlipItIn/Views/ChallengeNotificationOverlay.xaml +++ b/SlipItIn/Views/ChallengeNotificationOverlay.xaml @@ -3,8 +3,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:vm="clr-namespace:SlipItIn.ViewModels" x:Class="SlipItIn.Views.ChallengeNotificationOverlay" - x:DataType="vm:GameBoardViewModel"> - + x:DataType="vm:GameBoardViewModel" + IsVisible="{Binding IsChallengeVisible}"> +