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:
@@ -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
|
||||
Reference in New Issue
Block a user