X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=tictactoe%2Ftictactoe.jsx;h=498e708fbf9cc3d733517ff91215300952afee31;hp=7ea8c6fa202106d88471e69404e09804bac19027;hb=a203a3aca4fb8428bfa47d7f05c3478780d69554;hpb=d01d6fa39a5616a147e16a51c32f84eafc1280cf diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx index 7ea8c6f..498e708 100644 --- a/tictactoe/tictactoe.jsx +++ b/tictactoe/tictactoe.jsx @@ -38,6 +38,19 @@ events.addEventListener("game-info", event => { window.game.set_game_info(info); }); +events.addEventListener("player-info", event => { + const info = JSON.parse(event.data); + + window.game.set_player_info(info); +}); + +events.addEventListener("player-update", event => { + const info = JSON.parse(event.data); + + if (info.id === window.game.state.player_info.id) + window.game.set_player_info(info); +}); + events.addEventListener("move", event => { const move = JSON.parse(event.data); @@ -67,6 +80,15 @@ function GameInfo(props) { ); } +function PlayerInfo(props) { + return ( +