diff --git a/back/src/Game.ts b/back/src/Game.ts index dbc4612..043e1f2 100644 --- a/back/src/Game.ts +++ b/back/src/Game.ts @@ -125,11 +125,10 @@ export default class Game { const p = this.players[i]; if (p.rank || p.disconnected) continue; playerPromises.push(new Promise(resolve => { - p.client.once('prepare', order => { + p.client.once('prepare', stack => { delete p.disconnectListener; (() => { - - + p.stack = stack; p.client.socket.disconnect(); logSocket(p.client.socket, 'Bad cards argument on turn'); })(); diff --git a/front/pages/index.tsx b/front/pages/index.tsx index 8246f9a..2a15c6c 100644 --- a/front/pages/index.tsx +++ b/front/pages/index.tsx @@ -29,11 +29,10 @@ export default function Game() { const [roomHost, setRoomHost] = useState(''); const [gameState, setGameState] = useState(null); - const [cardSelected, setCardSelected] = useState([]); const [num, setNum] = useState(0); - const [stackSelected, setStackSelected] = useState([]); + const [cardSelected, setCardSelected] = useState([]); useEffect(() => { const socket = io(process.env.NEXT_PUBLIC_BACK_HOST!); @@ -122,8 +121,31 @@ export default function Game() { ))} - - + {`Rearrange your card stack from top to bottom!`} +
+

Your cards:

+ {gameState.cards.map((card, i) => ( + + ))} + +
); }