Skip to content

Commit

Permalink
Display game password only if the game is private
Browse files Browse the repository at this point in the history
  • Loading branch information
ethinot committed Apr 23, 2023
1 parent c71c27c commit 83224ac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Game.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
top: 210px;
left: 10px;
border-radius: 10px;
padding: 1.5%;
padding: 1.3%;
background-color: rgb(175, 82, 141);
color: white;
}
Expand Down
12 changes: 9 additions & 3 deletions client/src/phaser/scenes/GameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@ export default class GameScene extends Phaser.Scene {
const gamePass = localStorage.getItem("gamePassword");
const gamePassword = document.getElementById("gamePassword");
if (!gamePassword) return;
gamePassword.textContent = !gamePass
? "No Password"
: "Password : " + gamePass;

console.log("Le mot de passe du jeu public est-il défini ? " + gamePass);

if (gamePass !== "undefined") {
gamePassword.textContent = "Password: " + gamePass;
gamePassword.style.display = "block";
} else {
gamePassword.style.display = "none";
}
}
}
1 change: 0 additions & 1 deletion server/src/api/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gameRouteur
};
gameManager.createGame(settings);
const password = gameManager.getGame(settings.roomId)?.password;
console.log("Mot de pass du back :" + password);
res.json({ roomId: settings.roomId, roomPass: password });
}
);
Expand Down

0 comments on commit 83224ac

Please sign in to comment.