diff --git a/client/src/Placard.css b/client/src/Placard.css new file mode 100644 index 0000000..7c4b4ae --- /dev/null +++ b/client/src/Placard.css @@ -0,0 +1,54 @@ +.Placard { + display: flex; + position: relative; + width: 9.4em; + height: 11.44em; + background-position: center left; + background-repeat: no-repeat; + background-size: cover; + margin: 0.25em 0; + display: inline-block; + display: flex; + flex-direction: column; + justify-items: space-between; + pointer-events: none; +} + +.Placard > div { + box-sizing: border-box; + margin: 0 0.9em; +} + +.Placard:not([disabled]) { + cursor: pointer; + pointer-events: all; +} + +.Placard.Selected { + filter: brightness(110%); + transform-origin: 100% 100%; + transform: scale(1.5); + z-index: 10000; +} + +.Placard > div:nth-child(1) { + height: 15.5%; +} + +.Placard > div:nth-child(2), +.Placard > div:nth-child(3), +.Placard > div:nth-child(4), +.Placard > div:nth-child(5) { + height: 15.25%; +} + +.Placard > div:nth-child(6) { + flex: 1; +} + +.Placard > div:hover:nth-child(2), +.Placard > div:hover:nth-child(3), +.Placard > div:hover:nth-child(4), +.Placard > div:hover:nth-child(5) { + background-color: #ffffff40; +} diff --git a/client/src/Placard.js b/client/src/Placard.js new file mode 100644 index 0000000..46fe033 --- /dev/null +++ b/client/src/Placard.js @@ -0,0 +1,70 @@ +import React from "react"; +import "./Placard.css"; +import { assetsPath } from './Common.js'; + +const Placard = ({table, type, active, disabled}) => { + const dismissClicked = (event) => { + table.setState({ buildActive: false }); + } + + const buildClicked = (event) => { + if (!type.match(/^l.*/)) { + if (!table.state.buildActive) { + table.setState({ buildActive: true }); + } + } + }; + + const roadClicked = (event) => { + table.buyRoad(); + table.setState({ buildActive: false }); + }; + + const settlementClicked = (event) => { + table.buySettlement(); + table.setState({ buildActive: false }); + }; + + const cityClicked = (event) => { + table.buyCity(); + table.setState({ buildActive: false }); + }; + + const developmentClicked = (event) => { + table.buyDevelopment(); + table.setState({ buildActive: false }); + }; + + let buttons; + switch (active ? type : undefined) { + case 'orange': + case 'red': + case 'white': + case 'blue': + buttons = <> +
+
+
+
+
+
+ ; + break; + default: + buttons = <>; + break; + } + + return ( +
{buttons}
+ ); +}; + +export default Placard; diff --git a/client/src/PlayersStatus.js b/client/src/PlayersStatus.js index 31c3ff3..e3af5b0 100644 --- a/client/src/PlayersStatus.js +++ b/client/src/PlayersStatus.js @@ -13,8 +13,13 @@ const Player = ({ table, color, onClick, reverse }) => { const game = table.game; const player = game.players[color]; - const developmentCards = player.unplayed ? : undefined; - const armyCards = player.army ? : undefined; + const developmentCards = player.unplayed + ? + : undefined; + const armyCards = player.army + ? + : undefined; let points = <>; if (player.points && reverse) { points = <>{player.points}; @@ -42,9 +47,13 @@ const Player = ({ table, color, onClick, reverse }) => { {getPlayerName(game.sessions, color)}
- { game.color === color &&
Longest road: {player.longestRoad}
} + { game.color === color && +
+ Longest road: {player.longestRoad ? player.longestRoad : 0} +
+ }
{points}
- { largestArmy || longestRoad || armyCards || developmentCards && <> + { (largestArmy || longestRoad || armyCards || developmentCards) && <>
{ !reverse && <> { largestArmy } diff --git a/client/src/notes.md b/client/src/notes.md new file mode 100644 index 0000000..41f87f4 --- /dev/null +++ b/client/src/notes.md @@ -0,0 +1,27 @@ + +Game Order +--- + +If game-order active, show Game Order dialog. + +Game Order dialog: + +* List all active players +* List each active player's roll +* Sort order as player roll comes in +* Message indicates what is going on + +Roll dice + +R 6 +O 5 +W 5 +B 3 + +O 6 +W 6 + +O 3 +W 5 + +Final order: R W O B \ No newline at end of file