X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=tictactoe%2Ftictactoe.jsx;h=ca0bce3fd4985bf8636893cbfeae92ea4235508b;hp=579526b7dcb401e0310027da092f47c8fead5691;hb=9848e7d60b7ad9153b5763801382b880535e8cc6;hpb=868ec74bb12cbae18d2bd666d67f9e82ba38ee96
diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx
index 579526b..ca0bce3 100644
--- a/tictactoe/tictactoe.jsx
+++ b/tictactoe/tictactoe.jsx
@@ -44,11 +44,19 @@ events.addEventListener("player-info", event => {
window.game.set_player_info(info);
});
+events.addEventListener("player-enter", event => {
+ const info = JSON.parse(event.data);
+
+ window.game.set_opponent_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);
+ else
+ window.game.set_opponent_info(info);
});
events.addEventListener("move", event => {
@@ -83,15 +91,59 @@ function GameInfo(props) {
);
}
+function TeamButton(props) {
+ return ;
+}
+
+function TeamChoices(props) {
+ let other_team;
+ if (props.player.team === "X")
+ other_team = "O";
+ else
+ other_team = "X";
+
+ if (props.player.team === "") {
+ if (props.first_move) {
+ return null;
+ } else {
+ return [
+