feat: FRO-3 FRO-4 Added vue compontents to ingame and lobby (#100)

Added vue compontents to ingame and lobby.

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #100
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
This commit is contained in:
2025-12-04 08:00:58 +01:00
committed by Janis
parent 49a1bd40ff
commit 194df5691c
5 changed files with 686 additions and 570 deletions

View File

@@ -1,59 +1,5 @@
function handlePlayCard(card, dog) {
if(!canPlayCard) return
canPlayCard = false;
const cardId = card.dataset.cardId;
console.debug(`Playing card ${cardId} from hand`)
const wiggleKeyframes = [
{ transform: 'translateX(0)' },
{ transform: 'translateX(-5px)' },
{ transform: 'translateX(5px)' },
{ transform: 'translateX(-5px)' },
{ transform: 'translateX(0)' }
];
const wiggleTiming = {
duration: 400,
iterations: 1,
easing: 'ease-in-out',
fill: 'forwards'
};
const cardslide = $('#card-slide')
const payload = {
cardindex: cardId,
isDog: dog
}
sendEventAndWait("PlayCard", payload).then(
() => {
card.parentElement.remove();
cardslide.find('.handcard').each(function(newIndex) {
const $innerButton = $(this).find('.btn');
$innerButton.attr('data-card-id', newIndex);
const isInDogLife = $innerButton.attr('onclick').includes("'true'") ? 'true' : 'false';
$innerButton.attr('onclick', `handlePlayCard(this, '${isInDogLife}')`);
console.debug(`Re-indexed card: Old index was ${$innerButton.attr('data-card-id')}, New index is ${newIndex}`);
});
cardslide.addClass("inactive")
}
).catch(
(err) => {
canPlayCard = true;
const cardslide = $('#card-slide')
cardslide.removeClass("inactive")
card.parentElement.animate(wiggleKeyframes, wiggleTiming);
alertMessage(err.message)
}
)
function handlePlayCard(cardidx) {
//TODO: Needs implementation
}
function handleSkipDogLife(button) {
@@ -79,4 +25,9 @@ function handleKickPlayer(playerId) {
}
function handleReturnToLobby() {
sendEvent("ReturnToLobby")
}
}
globalThis.startGame = startGame
globalThis.handleTrumpSelection = handleTrumpSelection
globalThis.handleKickPlayer = handleKickPlayer
globalThis.handleReturnToLobby = handleReturnToLobby