fix(game): aktualisiere Handkarten nach gespieltem Slip
Some checks failed
Build / build (push) Has been cancelled
OpenWiki Update / update (push) Has been cancelled

This commit is contained in:
Tim Krampitz
2026-09-10 22:03:36 +02:00
parent 01b6a41bc6
commit 732b03edb4
5 changed files with 11 additions and 3 deletions

View File

@@ -324,10 +324,12 @@ public class GameHubTests
_gameService.Setup(s => s.SubmitSlipAsync(game.Id, player.Id, 55)).ReturnsAsync(true); _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.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); await _hub.SubmitSlip(game.Id, player.Id, 55);
_groupProxy.Verify(p => p.SendCoreAsync("SlipSubmitted", It.IsAny<object?[]>(), default), Times.Once); _groupProxy.Verify(p => p.SendCoreAsync("SlipSubmitted", It.IsAny<object?[]>(), default), Times.Once);
_callerProxy.Verify(p => p.SendCoreAsync("PlayerHandUpdated", It.IsAny<object?[]>(), default), Times.Once);
} }
[Fact] [Fact]

View File

@@ -233,6 +233,7 @@ public class GameHub : Hub
var result = await _gameService.SubmitSlipAsync(gameId, playerId, cardId); var result = await _gameService.SubmitSlipAsync(gameId, playerId, cardId);
var game = await _gameService.GetGameAsync(gameId); var game = await _gameService.GetGameAsync(gameId);
var hand = await _gameService.GetPlayerHandAsync(playerId);
await Clients.Group(game.LobbyCode).SendAsync("SlipSubmitted", new await Clients.Group(game.LobbyCode).SendAsync("SlipSubmitted", new
{ {
@@ -240,6 +241,7 @@ public class GameHub : Hub
CardId = cardId, CardId = cardId,
Success = result Success = result
}); });
await Clients.Caller.SendAsync("PlayerHandUpdated", hand);
} }
catch (UnauthorizedAccessException ex) catch (UnauthorizedAccessException ex)
{ {

View File

@@ -212,7 +212,7 @@ public partial class GameBoardViewModel : BaseViewModel,
MainThread.BeginInvokeOnMainThread(() => MainThread.BeginInvokeOnMainThread(() =>
{ {
MyCards.Clear(); MyCards.Clear();
foreach (var card in message.Value.Cards) foreach (var card in message.Value.Cards.Where(card => !card.IsUsed))
MyCards.Add(card); MyCards.Add(card);
}); });
} }

View File

@@ -3,8 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:SlipItIn.ViewModels" xmlns:vm="clr-namespace:SlipItIn.ViewModels"
x:Class="SlipItIn.Views.ChallengeNotificationOverlay" x:Class="SlipItIn.Views.ChallengeNotificationOverlay"
x:DataType="vm:GameBoardViewModel"> x:DataType="vm:GameBoardViewModel"
<Grid BackgroundColor="#88000000" IsVisible="{Binding IsChallengeVisible}" Padding="24"> IsVisible="{Binding IsChallengeVisible}">
<Grid BackgroundColor="#88000000" Padding="24">
<Border VerticalOptions="Center" HorizontalOptions="Center" Stroke="LightGray" StrokeShape="RoundRectangle 12" BackgroundColor="White" Padding="16"> <Border VerticalOptions="Center" HorizontalOptions="Center" Stroke="LightGray" StrokeShape="RoundRectangle 12" BackgroundColor="White" Padding="16">
<VerticalStackLayout Spacing="10"> <VerticalStackLayout Spacing="10">
<Label Text="Du wurdest beschuldigt" FontAttributes="Bold" /> <Label Text="Du wurdest beschuldigt" FontAttributes="Bold" />

View File

@@ -18,6 +18,9 @@
<Label Text="Meine Phrasen" FontAttributes="Bold" /> <Label Text="Meine Phrasen" FontAttributes="Bold" />
<CollectionView ItemsSource="{Binding MyCards}"> <CollectionView ItemsSource="{Binding MyCards}">
<CollectionView.EmptyView>
<Label Text="Keine ungespielten Phrasen mehr." />
</CollectionView.EmptyView>
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border Margin="0,4" Padding="10" Stroke="LightGray" StrokeThickness="1" StrokeShape="RoundRectangle 10" BackgroundColor="White"> <Border Margin="0,4" Padding="10" Stroke="LightGray" StrokeThickness="1" StrokeShape="RoundRectangle 10" BackgroundColor="White">