feat(ui): Websocket
Started implementing functionality to the Websocket
This commit is contained in:
@@ -133,9 +133,9 @@ function trickEndEvent(eventData) {
|
||||
playerorder.forEach( player => {
|
||||
newHtml += `
|
||||
<div class="d-flex justify-content-between score-row pt-1">
|
||||
<div style="width: 50%" class="text-truncate">'${player}'</div>
|
||||
<div style="width: 50%" class="text-truncate">${player}</div>
|
||||
<div style="width: 50%">
|
||||
'${playercounts.get(player)}'
|
||||
${playercounts.get(player)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
@@ -143,22 +143,23 @@ function trickEndEvent(eventData) {
|
||||
tricktable.html(newHtml);
|
||||
}
|
||||
function newTrickEvent() {
|
||||
const firstCardContainer = $('first-card-container');
|
||||
const firstCardContainer = $('#first-card-container');
|
||||
|
||||
let newHtml = '';
|
||||
|
||||
newHtml += `
|
||||
<img src="images/cards/1B.png" alt="Blank Card" width="80px"/>
|
||||
<img src="/assets/images/cards/1B.png" alt="Blank Card" width="80px" style="border-radius: 6px"/>
|
||||
`;
|
||||
|
||||
console.log("NEW TRICK EVENT")
|
||||
firstCardContainer.html(newHtml);
|
||||
}
|
||||
function requestCardEvent(eventData) {
|
||||
const player = eventData.player;
|
||||
const handElement = $('#card-slide')
|
||||
console.log("PLAY A CARD")
|
||||
handElement.removeClass('inactive');
|
||||
}
|
||||
//alertMessage("It worked!")
|
||||
//alertMessage("JANIS DU DUMMER WICHSER")
|
||||
//alertMessage("NOCHMAL DUMMER WICHSER")
|
||||
|
||||
|
||||
function receiveGameStateChange(eventData) {
|
||||
@@ -212,4 +213,6 @@ onEvent("NewRoundEvent", newRoundEvent)
|
||||
onEvent("TrickEndEvent", trickEndEvent)
|
||||
onEvent("NewTrickEvent", newTrickEvent)
|
||||
onEvent("RequestCardEvent", requestCardEvent)
|
||||
onEvent("CardPlayedEvent", receiveCardPlayedEvent)
|
||||
onEvent("CardPlayedEvent", receiveCardPlayedEvent)
|
||||
|
||||
globalThis.alertMessage = alertMessage
|
||||
Reference in New Issue
Block a user