main
Last change
on this file since 189cd8f was 3a783f2, checked in by anastasovv <simon@…>, 2 years ago |
Finished poker and added ball to roulette
|
-
Property mode
set to
100644
|
File size:
2.3 KB
|
Line | |
---|
1 | import React from 'react'
|
---|
2 |
|
---|
3 | import { useSelector } from 'react-redux'
|
---|
4 |
|
---|
5 | const Messages = () => {
|
---|
6 | const playerState = useSelector(state => state.player);
|
---|
7 | const styleState = useSelector(state => state.style);
|
---|
8 |
|
---|
9 | let roundMessage = '';
|
---|
10 | if (playerState.pokerGame.table.round === 1) {
|
---|
11 | roundMessage = ' - Everyone must call $20 before cards are dealt.';
|
---|
12 | }
|
---|
13 |
|
---|
14 | let turnMessage = '';
|
---|
15 | let callMessage = '';
|
---|
16 | if (playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx] !== undefined) {
|
---|
17 | turnMessage = `It\'s ${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName}\'s turn.`;
|
---|
18 |
|
---|
19 | if (parseInt(playerState.pokerGame.table.lastBet) > 0) {
|
---|
20 | callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${Math.min(playerState.player.credits, playerState.pokerGame.table.lastBet)}`;
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | return (
|
---|
25 | <div className="pokerMessagesContainer">
|
---|
26 | { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length === 1 && <p>Game over - {playerState.pokerGame.table.winners[0]?.displayName} won ${playerState.pokerGame.table.winners[0]?.wonAmount} with a {playerState.pokerGame.table.winners[0]?.hand?.hand} combination! Congratulations.</p> }
|
---|
27 | { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length > 1 && <p>Game over - {playerState.pokerGame.table.winners.map(e=>e.displayName).join(", ")} drew!</p> }
|
---|
28 | { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && <p>New game will start soon.</p> }
|
---|
29 |
|
---|
30 | { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>Round {playerState.pokerGame.table.round}/4{roundMessage}</p> }
|
---|
31 | { !playerState.pokerGame.table.started && <p>Waiting for coordinator {playerState.pokerGame.table.creator} to start the game.</p> }
|
---|
32 | { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{turnMessage}</p> }
|
---|
33 | { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{callMessage}</p> }
|
---|
34 | </div>
|
---|
35 | )
|
---|
36 | }
|
---|
37 |
|
---|
38 | export default Messages |
---|
Note:
See
TracBrowser
for help on using the repository browser.