affichage dos des tuiles
This commit is contained in:
parent
d24eac42dd
commit
668e355132
1 changed files with 19 additions and 25 deletions
|
|
@ -157,31 +157,20 @@
|
|||
console.log('Réponse API', data);
|
||||
if (data.state && data.state.hand_player) {
|
||||
displayHand(data.state.hand_player, 'hand-0');
|
||||
// joueur 1
|
||||
fetch('/api/game/hand/1')
|
||||
}
|
||||
// Affichage des mains bots (1, 2, 3)
|
||||
[1, 2, 3].forEach(id => {
|
||||
fetch(`/api/game/hand/${id}`)
|
||||
.then(r => r.json())
|
||||
.then(botData => {
|
||||
if (botData.hand) {
|
||||
displayHand(botData.hand, 'hand-1');
|
||||
displayHand(botData.hand, `hand-${id}`);
|
||||
} else {
|
||||
console.error(`Main vide pour joueur ${id}`);
|
||||
}
|
||||
})
|
||||
.catch(e => console.error(`Erreur main ${id}`, e));
|
||||
});
|
||||
// joueur 2
|
||||
fetch('/api/game/hand/2')
|
||||
.then(r => r.json())
|
||||
.then(botData => {
|
||||
if (botData.hand) {
|
||||
displayHand(botData.hand, 'hand-2');
|
||||
}
|
||||
});
|
||||
// joueur 3
|
||||
fetch('/api/game/hand/3')
|
||||
.then(r => r.json())
|
||||
.then(botData => {
|
||||
if (botData.hand) {
|
||||
displayHand(botData.hand, 'hand-3');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(e => console.error('Erreur initialisation partie', e));
|
||||
|
||||
|
|
@ -190,7 +179,12 @@
|
|||
display.innerHTML = '';
|
||||
hand.forEach(tile => {
|
||||
const tileDiv = document.createElement('div');
|
||||
// Affiche le dos des tuiles pour les bots
|
||||
if (displayId !== 'hand-0') {
|
||||
tileDiv.innerHTML = '<svg viewBox="0 0 310 410" width="60" height="80"><image href="/img/Regular/Back.svg" width="310" height="410"/></svg>';
|
||||
} else {
|
||||
tileDiv.innerHTML = tile.svg;
|
||||
}
|
||||
display.appendChild(tileDiv);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue