fix(game): aktualisiere Handkarten nach gespieltem Slip
This commit is contained in:
@@ -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]
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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" />
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user