Merge branch 'main' of codeberg.org:adrien-lsh/ft_transcendence

This commit is contained in:
Kbz-8 2024-05-06 18:19:36 +02:00
commit 2b2f2d0dcf
6 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,5 @@
import { client } from "../../../index.js"; import { client, lang } from "../../../index.js";
import { AGame } from "../AGame.js"; import { AGame } from "../AGame.js";
class TicTacToe class TicTacToe
@ -87,7 +88,7 @@ class TicTacToe
this.context.closePath(); this.context.closePath();
this.context.beginPath(); this.context.beginPath();
this.context.fillStyle = (winning_sign == "o") ? "red" : "green"; this.context.fillStyle = (winning_sign == "o") ? "red" : "green";
this.context.fillText((winning_sign == "o") ? "Winner is : O" : "Winner is : X", this.width / 2 - 30, this.height - this.gap / 2, 140); this.context.fillText((winning_sign == "o") ? lang.get("morpionWin") + "O" : lang.get("morpionWin") + "X", this.width / 2 - 30, this.height - this.gap / 2, 140);
this.context.closePath(); this.context.closePath();
} }
checkWin() checkWin()

View File

@ -46,6 +46,7 @@
"ruleBase" : "cramptun. Vous devez quouicougagner sur une des 9 quoicougrilles pour gagner la croustipartie", "ruleBase" : "cramptun. Vous devez quouicougagner sur une des 9 quoicougrilles pour gagner la croustipartie",
"ruleMovement" : "quoicoudeux. Vous quoicommencez sur le morpion quoicoucentral, et jouez sur le quoicoumorpion correspondant a votre croustichoix a votre prochain cramptour", "ruleMovement" : "quoicoudeux. Vous quoicommencez sur le morpion quoicoucentral, et jouez sur le quoicoumorpion correspondant a votre croustichoix a votre prochain cramptour",
"ruleDraw" : "cramptrois. Si votre quoicouchoix rempli entièrement un quoicoumorpion et provoque une cramptégalité, vous perdez", "ruleDraw" : "cramptrois. Si votre quoicouchoix rempli entièrement un quoicoumorpion et provoque une cramptégalité, vous perdez",
"morpionWin" : "Le quoicougagnant est :",
"matchmakingTitle": "Matchmaking crampté", "matchmakingTitle": "Matchmaking crampté",
"matchmakingStartSearch": "Cramptrouver une partie", "matchmakingStartSearch": "Cramptrouver une partie",
"matchmakingStopSearch": "Crampter le matchmaking", "matchmakingStopSearch": "Crampter le matchmaking",

View File

@ -45,6 +45,7 @@
"ruleBase" : "1. Win on one of the 9 tictactoe to win the game", "ruleBase" : "1. Win on one of the 9 tictactoe to win the game",
"ruleMovement" : "2. You start on the central tictactoe, and play on the one corresponding to your choice on the next turn", "ruleMovement" : "2. You start on the central tictactoe, and play on the one corresponding to your choice on the next turn",
"ruleDraw" : "3. If your play cause a tictactoe to be full and a draw, you lose the game", "ruleDraw" : "3. If your play cause a tictactoe to be full and a draw, you lose the game",
"morpionWin" : "The winner is :",
"matchmakingTitle": "Matchmaking", "matchmakingTitle": "Matchmaking",
"matchmakingStartSearch": "Find a game", "matchmakingStartSearch": "Find a game",
"matchmakingStopSearch": "Stop matchmaking", "matchmakingStopSearch": "Stop matchmaking",

View File

@ -45,6 +45,7 @@
"ruleBase" : "1. Vous devez gagner sur une des 9 grilles pour gagner la partie", "ruleBase" : "1. Vous devez gagner sur une des 9 grilles pour gagner la partie",
"ruleMovement" : "2. Vous commencez sur le morpion central, et jouez sur le morpion correspondant a votre choix a votre prochain tour", "ruleMovement" : "2. Vous commencez sur le morpion central, et jouez sur le morpion correspondant a votre choix a votre prochain tour",
"ruleDraw" : "3. Si votre choix rempli entièrement un morpion et provoque une égalité, vous perdez", "ruleDraw" : "3. Si votre choix rempli entièrement un morpion et provoque une égalité, vous perdez",
"morpionWin" : "Le gagnant est :",
"matchmakingTitle": "Matchmaking", "matchmakingTitle": "Matchmaking",
"matchmakingStartSearch": "Trouver une partie", "matchmakingStartSearch": "Trouver une partie",
"matchmakingStopSearch": "Arrêter le matchmaking", "matchmakingStopSearch": "Arrêter le matchmaking",

View File

@ -45,6 +45,7 @@
"ruleBase" : "1. Win on wan pi the 9 tictactoe tawa win the game", "ruleBase" : "1. Win on wan pi the 9 tictactoe tawa win the game",
"ruleMovement" : "2. Sina open on the central tictactoe, en play on the wan corresponding tawa your choice on the next turn", "ruleMovement" : "2. Sina open on the central tictactoe, en play on the wan corresponding tawa your choice on the next turn",
"ruleDraw" : "3. If your play cause a tictactoe tawa be full en a draw, sina lose the game", "ruleDraw" : "3. If your play cause a tictactoe tawa be full en a draw, sina lose the game",
"morpionWin" : "jan li jo e poka sina :",
"matchmakingTitle": "Matchmaking", "matchmakingTitle": "Matchmaking",
"matchmakingStartSearch": "lukin e ilo musi", "matchmakingStartSearch": "lukin e ilo musi",
"matchmakingStopSearch": "o pini e pana sona e jan pi pana sona e jan ante.", "matchmakingStopSearch": "o pini e pana sona e jan pi pana sona e jan ante.",

View File

@ -34,10 +34,7 @@ export default class extends AbstractAuthenticatedView {
{ {
if (data.detail === "game_found") if (data.detail === "game_found")
{ {
if (this.game_type_input.value == "pong") navigateTo(`/games/${data.game_type}/${data.game_id}`);
navigateTo(`/games/${data.game_type}/${data.game_id}`);
else
navigateTo(`/games/${data.game_type}/${data.game_id}`);
return; return;
} }
this.display_data(data); this.display_data(data);
@ -122,7 +119,7 @@ export default class extends AbstractAuthenticatedView {
<option value='pong'>Pong</option> <option value='pong'>Pong</option>
<option value='tictactoe'>ticTacToe</option> <option value='tictactoe'>ticTacToe</option>
</select> </select>
<label for='game-type-input'>${lang.get("game_typeChoice")}</label> <label for='game-type-input'>${lang.get("gamemodeChoice")}</label>
</div> </div>
<div class='form-floating mb-2' id='nb-players-div'> <div class='form-floating mb-2' id='nb-players-div'>
<input type='number' min='2' value='2' max='4' class='form-control' id='nb-players-input' placeholder='${lang.get("matchmakingNbPlayers")}'> <input type='number' min='2' value='2' max='4' class='form-control' id='nb-players-input' placeholder='${lang.get("matchmakingNbPlayers")}'>