feat(game)!: Add winner display and return to lobby functionality
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
@import de.knockoutwhist.control.controllerBaseImpl.sublogic.util.TrickUtil
|
||||
@import de.knockoutwhist.utils.Implicits.*
|
||||
|
||||
@(player: de.knockoutwhist.player.AbstractPlayer, gamelobby: logic.game.GameLobby)
|
||||
|
||||
@main("Ingame") {
|
||||
<div class="lobby-background vh-100">
|
||||
<main class="game-field-background vh-100 ingame-side-shadow">
|
||||
<div class="py-5 container-xxl">
|
||||
@@ -72,16 +72,18 @@
|
||||
</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 ingame-cards-slide" id="card-slide">
|
||||
<div class="row justify-content-center ingame-cards-slide @{
|
||||
!gamelobby.logic.getCurrentPlayer.contains(player) ? "inactive" |: ""
|
||||
}" 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', @player.isInDogLife)">
|
||||
@util.WebUIUtils.cardtoImage(player.currentHand().get.cards(i)) width="120px" style="border-radius: 6px"/>
|
||||
</div>
|
||||
@if(player.isInDogLife) {
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-danger" onclick="handleSkipDogLife('@gamelobby.id')">Skip Dog Life</button>
|
||||
<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', '@player.isInDogLife')">
|
||||
@util.WebUIUtils.cardtoImage(player.currentHand().get.cards(i)) width="120px" style="border-radius: 6px"/>
|
||||
</div>
|
||||
@if(player.isInDogLife) {
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-danger" onclick="handleSkipDogLife(this, '@gamelobby.id')">Skip Dog Life</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -91,8 +93,15 @@
|
||||
</main>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
pollForUpdates('@gamelobby.id');
|
||||
});
|
||||
function waitForFunction(name, checkInterval = 100) {
|
||||
return new Promise(resolve => {
|
||||
const timer = setInterval(() => {
|
||||
if (typeof window[name] === "function") {
|
||||
clearInterval(timer);
|
||||
resolve(window[name]);
|
||||
}
|
||||
}, checkInterval);
|
||||
});
|
||||
}
|
||||
waitForFunction("pollForUpdates").then(fn => fn('@gamelobby.id'));
|
||||
</script>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user