diff --git a/businesses/Room.js b/businesses/Room.js index 9993b14..3231837 100644 --- a/businesses/Room.js +++ b/businesses/Room.js @@ -1,8 +1,7 @@ class Room { - constructor(room) { + constructor() { this.id = this.generateRoomId(); // change the id with something prettier this.players = []; - this.room = room; this.actualPlayer = ""; this.ennemy = ""; } @@ -28,14 +27,6 @@ class Room { return this.actualPlayer } - /* - endGame() { - this.room.players.forEach((player) => - io.to(player.socketId).emit("end game"), - ); - } - */ - move(move) { let ret = {isMove: false, player: this.actualPlayer} let playedCase = this.players.find((p) => p.id === this.ennemy).grid.cases[move.col][move.row]; @@ -76,6 +67,7 @@ class Room { validBoards() { this.players.forEach((player) => { + // sometimes i get error here player.pieces.forEach((piece) => { for (let i = piece.startPos.x; i <= piece.endPos.x; i++) { for (let j = piece.startPos.y; j <= piece.endPos.y; j++) { diff --git a/public/assets/style.css b/public/assets/style.css index 7f27a19..7f6d109 100644 --- a/public/assets/style.css +++ b/public/assets/style.css @@ -8,7 +8,7 @@ display: none; } -#opponentLeftModal { +.modal { display: none; position: fixed; z-index: 1; @@ -21,25 +21,7 @@ background-color: rgba(0,0,0,0.4); } -#gameEndedModal { - display: none; - position: fixed; - z-index: 1; - left: 0; - top: 0; - width: 100%; - height: 100%; - overflow: auto; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0,0.4); -} - -#errorHandler { - margin-top: 3%; - color: red; -} - -#opponentLeftModalContent { +.modalContent { background-color: #fefefe; margin: 15% auto; padding: 20px; @@ -54,4 +36,16 @@ padding: 15px 20px; border: none; cursor: pointer; +} + +.buttonChoice { + display: flex; + flex-direction: row; + justify-content: space-evenly; +} + + +#errorHandler { + margin-top: 3%; + color: red; } \ No newline at end of file diff --git a/public/pages/gameView.html b/public/pages/gameView.html index 8449290..0ffe48e 100644 --- a/public/pages/gameView.html +++ b/public/pages/gameView.html @@ -8,17 +8,20 @@
Your opponent has left the game.
We have a winner
- +