feat(ci): Polling Added polling for when the game starts and a card gets played (#58)

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #58
This commit is contained in:
2025-11-14 09:11:32 +01:00
parent 370de175db
commit e60fe7c98d
15 changed files with 382 additions and 145 deletions

View File

@@ -4,7 +4,7 @@
@main("Ingame") {
<div class="lobby-background vh-100">
<main class="game-field-background vh-100">
<main class="game-field-background vh-100 ingame-side-shadow">
<div class="py-5 container-xxl">
<div class="row ms-4 me-4">
@@ -72,7 +72,7 @@
</div>
<div class="row justify-content-center g-2 mt-4 bottom-div" style="backdrop-filter: blur(4px); margin-left: 0; margin-right: 0;">
<div class="row justify-content-center" id="card-slide">
<div class="row justify-content-center ingame-cards-slide" id="card-slide">
@for(i <- player.currentHand().get.cards.indices) {
<div class="col-auto handcard" style="border-radius: 6px">
<div class="btn btn-outline-light p-0 border-0 shadow-none" data-card-id="@i" style="border-radius: 6px" onclick="handlePlayCard(this, '@gamelobby.id')">

View File

@@ -1,4 +1,4 @@
@(player: de.knockoutwhist.player.AbstractPlayer, logic: de.knockoutwhist.control.GameLogic, gameId: String)
@(player: de.knockoutwhist.player.AbstractPlayer, gamelobby: logic.game.GameLobby)
@main("Selecting Trumpsuit...") {
<div id="selecttrumpsuit" class="game-field game-field-background">
@@ -11,14 +11,14 @@
<h3 class="mb-0">Select Trump Suit</h3>
</div>
<div class="card-body">
@if(player.equals(logic.getCurrentMatch.get.roundlist.last.winner.get)) {
@if(player.equals(gamelobby.logic.getCurrentMatch.get.roundlist.last.winner.get)) {
<div class="alert alert-info" role="alert" aria-live="polite">
You (@player.toString) won the last round. Choose the trump suit for the next round.
</div>
<div class="row justify-content-center col-auto mb-5">
<div class="col-auto handcard">
<form action="@routes.IngameController.playTrump(gameId)" method="post">
<form action="@routes.IngameController.playTrump(gamelobby.id)" method="post">
<input type="hidden" name="cardId" value="0" />
<button type="submit" class="btn btn-outline-light p-0 border-0 shadow-none" name="trump" value="0" style="border-radius: 6px">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Spades)) width="120px" style="border-radius: 6px"/>
@@ -26,7 +26,7 @@
</form>
</div>
<div class="col-auto handcard">
<form action="@routes.IngameController.playTrump(gameId)" method="post">
<form action="@routes.IngameController.playTrump(gamelobby.id)" method="post">
<input type="hidden" name="cardId" value="1" />
<button type="submit" class="btn btn-outline-light p-0 border-0 shadow-none" name="trump" value="1" style="border-radius: 6px">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Hearts)) width="120px" style="border-radius: 6px"/>
@@ -34,7 +34,7 @@
</form>
</div>
<div class="col-auto handcard">
<form action="@routes.IngameController.playTrump(gameId)" method="post">
<form action="@routes.IngameController.playTrump(gamelobby.id)" method="post">
<input type="hidden" name="cardId" value="2" />
<button type="submit" class="btn btn-outline-light p-0 border-0 shadow-none" name="trump" value="2" style="border-radius: 6px">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Diamonds)) width="120px" style="border-radius: 6px"/>
@@ -42,7 +42,7 @@
</form>
</div>
<div class="col-auto handcard">
<form action="@routes.IngameController.playTrump(gameId)" method="post">
<form action="@routes.IngameController.playTrump(gamelobby.id)" method="post">
<input type="hidden" name="cardId" value="3" />
<button type="submit" class="btn btn-outline-light p-0 border-0 shadow-none" name="trump" value="3" style="border-radius: 6px">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Clubs)) width="120px" style="border-radius: 6px"/>
@@ -50,7 +50,7 @@
</form>
</div>
</div>
<div class="row justify-content-center" id="card-slide">
<div class="row justify-content-center ingame-cards-slide" id="card-slide">
@for(i <- player.currentHand().get.cards.indices) {
<div class="col-auto" style="border-radius: 6px">
@util.WebUIUtils.cardtoImage(player.currentHand().get.cards(i)) width="120px" style="border-radius: 6px"/>
@@ -59,7 +59,7 @@
</div>
} else {
<div class="alert alert-warning" role="alert" aria-live="polite">
@logic.getCurrentMatch.get.roundlist.last.winner.get.name is choosing a trumpsuit. The new round will start once a suit is picked.
@gamelobby.logic.getCurrentMatch.get.roundlist.last.winner.get.name is choosing a trumpsuit. The new round will start once a suit is picked.
</div>
}
</div>

View File

@@ -1,4 +1,4 @@
@(player: de.knockoutwhist.player.AbstractPlayer, logic: de.knockoutwhist.control.GameLogic, gameId: String)
@(player: de.knockoutwhist.player.AbstractPlayer, gamelobby: logic.game.GameLobby)
@main("Tie") {
<div id="tie" class="game-field game-field-background">
@@ -15,20 +15,20 @@
<p class="card-text">
The last round was tied between:
<span class="ms-1">
@for(players <- logic.playerTieLogic.getTiedPlayers) {
@for(players <- gamelobby.logic.playerTieLogic.getTiedPlayers) {
<span class="badge text-bg-secondary me-1">@players</span>
}
</span>
</p>
</div>
@if(player.equals(logic.playerTieLogic.currentTiePlayer())) {
@defining(logic.playerTieLogic.highestAllowedNumber()) { maxNum =>
@if(player.equals(gamelobby.logic.playerTieLogic.currentTiePlayer())) {
@defining(gamelobby.logic.playerTieLogic.highestAllowedNumber()) { maxNum =>
<div class="alert alert-info" role="alert" aria-live="polite">
Pick a number between 1 and @{maxNum + 1}. The resulting card will be your card for the cut.
</div>
<form class="row g-2 align-items-center" method="post" action="@routes.IngameController.playTie(gameId)">
<form class="row g-2 align-items-center" method="post" action="@routes.IngameController.playTie(gamelobby.id)">
<div class="col-auto">
<label for="tieNumber" class="col-form-label">Your number</label>
</div>
@@ -42,8 +42,8 @@
<h6 class="mt-4 mb-3">Currently Picked Cards</h6>
<div id="cardsplayed" class="row g-3 justify-content-center">
@if(logic.playerTieLogic.getSelectedCard.nonEmpty) {
@for((player, card) <- logic.playerTieLogic.getSelectedCard) {
@if(gamelobby.logic.playerTieLogic.getSelectedCard.nonEmpty) {
@for((player, card) <- gamelobby.logic.playerTieLogic.getSelectedCard) {
<div class="col-6">
<div class="card shadow-sm border-0 h-100 text-center">
<div class="card-body d-flex flex-column justify-content-between">
@@ -67,14 +67,14 @@
}
} else {
<div class="alert alert-warning" role="alert" aria-live="polite">
<strong>@logic.playerTieLogic.currentTiePlayer()</strong> is currently picking a number for the cut.
<strong>@gamelobby.logic.playerTieLogic.currentTiePlayer()</strong> is currently picking a number for the cut.
</div>
<h6 class="mt-4 mb-3">Currently Picked Cards</h6>
<div id="cardsplayed" class="row g-3 justify-content-center">
@if(logic.playerTieLogic.getSelectedCard.nonEmpty) {
@for((player, card) <- logic.playerTieLogic.getSelectedCard) {
@if(gamelobby.logic.playerTieLogic.getSelectedCard.nonEmpty) {
@for((player, card) <- gamelobby.logic.playerTieLogic.getSelectedCard) {
<div class="col-6 col-sm-4 col-md-3 col-lg-2">
<div class="card shadow-sm border-0 h-100 text-center">
<div class="card-body d-flex flex-column justify-content-between">