diff --git a/frontend/static/css/tictactoe.css b/frontend/static/css/tictactoe.css new file mode 100644 index 0000000..ff44527 --- /dev/null +++ b/frontend/static/css/tictactoe.css @@ -0,0 +1,5 @@ +#canva { + width: 660px; + height:660px; + margin: 0px auto; + } \ No newline at end of file diff --git a/frontend/static/js/views/MatchMakingView.js b/frontend/static/js/views/MatchMakingView.js index 6741583..6ca775e 100644 --- a/frontend/static/js/views/MatchMakingView.js +++ b/frontend/static/js/views/MatchMakingView.js @@ -20,8 +20,7 @@ export default class extends AbstractAuthenticatedView { else { let nb_players = this.input.value; - - await client.matchmaking.start(this.onreceive.bind(this), this.ondisconnect.bind(this), nb_players); + await client.matchmaking.start(this.onreceive.bind(this), this.ondisconnect.bind(this), nb_players, this.gamemode); this.button.innerHTML = lang.get("matchmakingStopSearch"); } @@ -36,7 +35,10 @@ export default class extends AbstractAuthenticatedView { { if (data.detail === "game_found") { - navigateTo(`/games/${data.game_id}`); + if (this.gamemode.value == "pong") + navigateTo(`/games/${data.game_id}`); + else + navigateTo(`/games/${this.gamemode.value}/${data.game_id}`); return; } this.display_data(data); @@ -52,7 +54,8 @@ export default class extends AbstractAuthenticatedView { { this.button = document.getElementById("toggle-search"); this.input = document.getElementById("nb-players-input"); - + this.gamemode = document.getElementById("game-choice"); + let container = document.getElementById("nb-players-container"); let gameChoice = document.getElementById("game-choice"); @@ -68,7 +71,7 @@ export default class extends AbstractAuthenticatedView { gameChoice.addEventListener("change", function() { - if (this.value === "TicTacToe") + if (this.value === "tictactoe") { container.style.display = 'none'; document.getElementById("nb-players-input").value = 2; @@ -94,8 +97,8 @@ export default class extends AbstractAuthenticatedView {