X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=tictactoe%2Ftictactoe.jsx;h=ca0bce3fd4985bf8636893cbfeae92ea4235508b;hp=46cee2a7f42e9f4bc3a7809e7d93b3855eb383ed;hb=9848e7d60b7ad9153b5763801382b880535e8cc6;hpb=7b54e4a8c6a461c186125b5e36d4d312ee9b41b2
diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx
index 46cee2a..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 [
+