diff --git a/public/game.js b/public/game.js new file mode 100644 index 0000000..790c4ce --- /dev/null +++ b/public/game.js @@ -0,0 +1,14 @@ +const client = io() + +client.on('role', (name) => { + role.innerText = name +}) + +client.on('player', (player) => { + gameButton.classList = player + gameButton.innerText = player == 'player1' ? '玩家1' : '玩家2' +}) + +gameButton.onclick = () => { + client.emit('click') +} diff --git a/public/index.html b/public/index.html index ac9fa54..9020d80 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,6 @@ - 陆战棋游戏