main
Last change
on this file since e007fcd was b13f93b, checked in by anastasovv <simon@…>, 2 years ago |
Made poker tables system and round 1
|
-
Property mode
set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[b13f93b] | 1 | import React from 'react'
|
---|
| 2 |
|
---|
| 3 | import { useSelector } from 'react-redux'
|
---|
| 4 | import FreeflowCard from '../../FreeflowCard';
|
---|
| 5 |
|
---|
| 6 | const Chairs = () => {
|
---|
| 7 | const playerState = useSelector(state => state.player);
|
---|
| 8 |
|
---|
| 9 | const positions = [
|
---|
| 10 | { x: 16, y: 35 },
|
---|
| 11 | { x: 16, y: 65 },
|
---|
| 12 | { x: 25, y: 85 },
|
---|
| 13 | { x: 40, y: 90 },
|
---|
| 14 | { x: 60, y: 90 },
|
---|
| 15 | { x: 75, y: 85 },
|
---|
| 16 | { x: 84, y: 65 },
|
---|
| 17 | { x: 84, y: 35 },
|
---|
| 18 | ]
|
---|
| 19 |
|
---|
| 20 | return (
|
---|
| 21 | <div className="pokerChairsContainer">
|
---|
| 22 | {positions.map((pos, i) => {
|
---|
| 23 | let extraClass = '';
|
---|
| 24 | if (i === playerState.pokerGame.table.turnIdx) extraClass = 'onTurn';
|
---|
| 25 | if (playerState.pokerGame.table.players[i] !== undefined && playerState.pokerGame.table.players[i].isFolded) extraClass = 'folded';
|
---|
| 26 |
|
---|
| 27 | return (
|
---|
| 28 | <div className={`pokerChair ${extraClass}`} style={{left: `${pos.x}vw`, top: `${pos.y}vh`}} key={'chair' + pos.x + pos.y}>
|
---|
| 29 | {playerState.pokerGame.table.players[i] !== undefined && playerState.pokerGame.table.players[i].isSatDown && (
|
---|
| 30 | <div className="pokerPlayerCardsContainer">
|
---|
| 31 | <div>
|
---|
| 32 | { playerState.pokerGame.table.players[i].cards[0] !== undefined && <FreeflowCard card={playerState.pokerGame.table.players[i].cards[0]}/> }
|
---|
| 33 | { playerState.pokerGame.table.players[i].cards[1] !== undefined && <FreeflowCard card={playerState.pokerGame.table.players[i].cards[1]}/> }
|
---|
| 34 | </div>
|
---|
| 35 | </div>
|
---|
| 36 | )}
|
---|
| 37 |
|
---|
| 38 | <div>
|
---|
| 39 | {playerState.pokerGame.table.players[i] !== undefined && playerState.pokerGame.table.players[i].isSatDown && <p>{playerState.pokerGame.table.players[i].displayName}</p>}
|
---|
| 40 | {playerState.pokerGame.table.players[i] !== undefined && playerState.pokerGame.table.players[i].isSatDown && <p>${playerState.pokerGame.table.players[i].betAmount}</p>}
|
---|
| 41 | </div>
|
---|
| 42 | </div>
|
---|
| 43 | )
|
---|
| 44 | })}
|
---|
| 45 | </div>
|
---|
| 46 | )
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | export default Chairs |
---|
Note:
See
TracBrowser
for help on using the repository browser.