From 668e355132ef1c499b1f5b81b8d37b3608e5e380 Mon Sep 17 00:00:00 2001 From: Didictateur Date: Wed, 25 Feb 2026 17:17:31 +0100 Subject: [PATCH] affichage dos des tuiles --- frontend/pages/riichi/chap5.html | 44 ++++++++++++++------------------ 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/frontend/pages/riichi/chap5.html b/frontend/pages/riichi/chap5.html index a7cc405..f8242a7 100644 --- a/frontend/pages/riichi/chap5.html +++ b/frontend/pages/riichi/chap5.html @@ -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') - .then(r => r.json()) - .then(botData => { - if (botData.hand) { - displayHand(botData.hand, 'hand-1'); - } - }); - // 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'); - } - }); } + // 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-${id}`); + } else { + console.error(`Main vide pour joueur ${id}`); + } + }) + .catch(e => console.error(`Erreur main ${id}`, e)); + }); }) .catch(e => console.error('Erreur initialisation partie', e)); @@ -190,7 +179,12 @@ display.innerHTML = ''; hand.forEach(tile => { const tileDiv = document.createElement('div'); - tileDiv.innerHTML = tile.svg; + // Affiche le dos des tuiles pour les bots + if (displayId !== 'hand-0') { + tileDiv.innerHTML = ''; + } else { + tileDiv.innerHTML = tile.svg; + } display.appendChild(tileDiv); }); }