diff --git a/src/Home.tsx b/src/Home.tsx index 8d832b1..f4b1156 100644 --- a/src/Home.tsx +++ b/src/Home.tsx @@ -132,12 +132,20 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => { context.rtmt.sendMessage(channel_leave_game, {}); }; + const getBoardIndex = (index: number) => { + if (userKey === game.player2Id) return index + game.board.pits.length / 2; + return index; + }; + const onHoleSelect = (index: number, pit: Pit) => { //TODO : stoneCount comes from view model! if (pit.stoneCount === 0) { //TODO : warn user return; } + boardViewModel.pits[getBoardIndex(index)].pitColor = + context.themeManager.theme.pitSelectedColor; + updateBoardViewModel(boardViewModel); const gameMove: GameMove = { index: index }; context.rtmt.sendMessage(channel_game_move, gameMove); };