feat(ui): enhance game UI with responsive design and new components

43 [Subtask] UI looks better and improved
This commit is contained in:
2025-11-09 20:22:15 +01:00
parent 1496179a6b
commit c45fb0caf3
8 changed files with 369 additions and 117 deletions

View File

@@ -1,27 +1,88 @@
@(player: de.knockoutwhist.player.AbstractPlayer, logic: de.knockoutwhist.control.GameLogic)
@(player: de.knockoutwhist.player.AbstractPlayer, logic: de.knockoutwhist.control.GameLogic, gameId: String)
@main("Selecting Trumpsuit...") {
<div id="selecttrumpsuit" class="game-field game-field-background">
@if(player.equals(logic.getCurrentMatch.get.roundlist.last.winner.get)) {
<h1>Knockout Whist</h1>
<p>You (@player.toString) have won the last round! Select a trumpsuit for the next round!</p>
<p>Available trumpsuits are displayed below:</p>
<div id="playercards">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Spades))
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Clubs))
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Hearts))
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Diamonds))
</div>
<p>Your cards</p>
<div class="ingame-stage blur-sides">
<div class="container py-4">
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-8">
<div class="card shadow-sm">
<div class="card-header text-center">
<h3 class="mb-0">Select Trump Suit</h3>
</div>
<div class="card-body">
@if(player.equals(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 id="playercards">
@for(card <- player.currentHand().get.cards) {
@util.WebUIUtils.cardtoImage(card)
}
<form method="post" action="@routes.IngameController.playTrump(gameId)">
<div class="row row-cols-2 row-cols-sm-4 g-3">
<div class="col">
<button class="btn btn-outline-dark w-100 h-100 py-3" type="submit" name="trump" value="0" aria-label="Spades">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Spades))
<div class="mt-2">Spades</div>
</button>
</div>
<div class="col">
<button class="btn btn-outline-danger w-100 h-100 py-3" type="submit" name="trumpSuit" value="1" aria-label="Hearts">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Hearts))
<div class="mt-2">Hearts</div>
</button>
</div>
<div class="col">
<button class="btn btn-outline-warning w-100 h-100 py-3" type="submit" name="trumpSuit" value="2" aria-label="Diamonds">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Diamonds))
<div class="mt-2">Diamonds</div>
</button>
</div>
<div class="col">
<button class="btn btn-outline-secondary w-100 h-100 py-3" type="submit" name="trumpSuit" value="3" aria-label="Clubs">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Clubs))
<div class="mt-2">Clubs</div>
</button>
</div>
</div>
</form>
} else {
<div class="alert alert-warning" role="alert" aria-live="polite">
@player.toString is choosing a trumpsuit. The new round will start once a suit is picked.
</div>
<div class="text-center">
<div class="row row-cols-2 row-cols-sm-4 g-3">
<div class="col">
<div class="btn btn-outline-dark disabled w-100 h-100 py-3" aria-disabled="true">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Spades))
<div class="mt-2">Spades</div>
</div>
</div>
<div class="col">
<div class="btn btn-outline-danger disabled w-100 h-100 py-3" aria-disabled="true">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Hearts))
<div class="mt-2">Hearts</div>
</div>
</div>
<div class="col">
<div class="btn btn-outline-warning disabled w-100 h-100 py-3" aria-disabled="true">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Diamonds))
<div class="mt-2">Diamonds</div>
</div>
</div>
<div class="col">
<div class="btn btn-outline-secondary disabled w-100 h-100 py-3" aria-disabled="true">
@util.WebUIUtils.cardtoImage(de.knockoutwhist.cards.Card(de.knockoutwhist.cards.CardValue.Ace, de.knockoutwhist.cards.Suit.Clubs))
<div class="mt-2">Clubs</div>
</div>
</div>
</div>
</div>
}
</div>
</div>
</div>
</div>
</div>
} else {
<h1>Knockout Whist</h1>
<p>@player.toString is choosing a trumpsuit. Starting new round when @player.toString picked a trumpsuit...</p>
}
</div>
</div>
}