aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--back/src/Game.ts2
-rw-r--r--front/pages/index.tsx49
2 files changed, 25 insertions, 26 deletions
diff --git a/back/src/Game.ts b/back/src/Game.ts
index 043e1f2..15155fd 100644
--- a/back/src/Game.ts
+++ b/back/src/Game.ts
@@ -174,7 +174,7 @@ export default class Game {
const p = this.players[this.lastPlayedPlayer];
this.broadcastGameState();
await new Promise<void>(resolve => {
- p.client.once('turn', selectedPlayer => {
+ p.client.once('flip', selectedPlayer => {
delete p.disconnectListener;
(() => {
if (this.players[selectedPlayer].stack.length > 0) {
diff --git a/front/pages/index.tsx b/front/pages/index.tsx
index 2a15c6c..1d8918c 100644
--- a/front/pages/index.tsx
+++ b/front/pages/index.tsx
@@ -123,29 +123,29 @@ export default function Game() {
</ul>
{`Rearrange your card stack from top to bottom!`}
<div>
- <p>Your cards:</p>
- {gameState.cards.map((card, i) => (
- <label key={card.rank+' '+card.suit}>
- <button
- onClick={() => {
- const tmp = gameState.cards[i];
- gameState.cards[i] = gameState.cards[i-1];
- gameState.cards[i-1] = tmp;
- }}
- disabled={i === 0}
- >
- Move left
- </button>
- {rankStrs[card.rank]+' '+suitChars[card.suit]}
- </label>
- ))}
- <button
- onClick={() => socket.emit('prepare', gameState.cards)}
- //disabled={username !== gameState.playerTurn || !canPlay(gameState.lastPlayed, selectedCards)}
- >
- I'm ready!
- </button>
- </div>
+ <p>Your cards:</p>
+ {gameState.cards.map((card, i) => (
+ <label key={card.rank+' '+card.suit+' '}>
+ <button
+ onClick={() => {
+ const tmp = gameState.cards[i];
+ gameState.cards[i] = gameState.cards[i-1];
+ gameState.cards[i-1] = tmp;
+ }}
+ disabled={i === 0}
+ >
+ Move left
+ </button>
+ {rankStrs[card.rank]+' '+suitChars[card.suit]+' '}
+ </label>
+ ))}
+ <button
+ onClick={() => socket.emit('prepare', gameState.cards)}
+ //disabled={username !== gameState.playerTurn || !canPlay(gameState.lastPlayed, selectedCards)}
+ >
+ I'm ready!
+ </button>
+ </div>
</>
);
}
@@ -170,7 +170,6 @@ export default function Game() {
</div>
{`It's ${gameState.playerTurn}'s turn!`}
<div>
- <p>Your cards:</p>
<input
type="text"
placeholder="Claim a number greater than the last claimed number..."
@@ -258,7 +257,7 @@ export default function Game() {
</label>
))}
<button
- onClick={() => socket.emit('turn', selectedCards)}
+ onClick={() => socket.emit('giveup', selectedCards[0])}
disabled={username !== gameState.playerTurn || selectedCards.length !== 1}
>
Give up this card!