hide button on solo game + fixed player list updates in lobby + fixed joining a already started game
This commit is contained in:
parent
a66f8e61e6
commit
ed8b928ebc
@ -85,6 +85,10 @@ def join_game():
|
||||
|
||||
if not game.add_member(username):
|
||||
return {"error": 1, "msg": f"Username '{username}' already used in game {game.game_id}"}
|
||||
|
||||
if game.has_started:
|
||||
return {"error": 1, "msg": f"Game {game.game_id} has already started"}
|
||||
|
||||
|
||||
flask.session["game_id"] = game.game_id
|
||||
flask.session["is_owner"] = False
|
||||
|
@ -129,7 +129,7 @@ html {
|
||||
.question_answer{
|
||||
border: var(--game-dark-gold) solid;
|
||||
border-radius: 1em;
|
||||
height: 5em;
|
||||
height: 6em;
|
||||
background-color: #000000d0;
|
||||
}
|
||||
|
||||
|
@ -317,6 +317,8 @@ function createCulpritSvgElement(buttonCssClass, pathAttributeValue, isHidden) {
|
||||
* Show the screen in which the player asks questions to the npcs.
|
||||
*/
|
||||
function renderInterrogation() {
|
||||
if (gameData["solo"] === true) document.getElementById("open_chat_button").classList.add("hidden");
|
||||
|
||||
document.getElementById("QA_0").textContent = gameData["questions"]["QA_0"];
|
||||
document.getElementById("QA_1").textContent = gameData["questions"]["QA_1"];
|
||||
|
||||
|
@ -137,7 +137,6 @@ function joinRoom() {
|
||||
response.then(() => {
|
||||
displayRoomView();
|
||||
displayPlayerList();
|
||||
initSock();
|
||||
hideFirstClassElement("join_room_view");
|
||||
})
|
||||
}
|
||||
@ -356,13 +355,15 @@ function initSock() {
|
||||
console.log("Connected to the server!");
|
||||
})
|
||||
|
||||
socket.on("gamestart", () => {
|
||||
window.location.href = "/multi";
|
||||
socket.on("gamestart", async () => {
|
||||
if (await hasJoinedRoom()) window.location.href = "/multi";
|
||||
})
|
||||
|
||||
socket.on("playersjoin", username => {
|
||||
console.log(username);
|
||||
document.querySelector(".player_names").textContent += username + "\n";
|
||||
Array.from(document.getElementsByClassName("player_names")).forEach(playerList =>{
|
||||
playerList.textContent += username + "\n";
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@ -385,8 +386,8 @@ function initSock() {
|
||||
async function initLobby() {
|
||||
setGameBackground(LOBBY_IMAGE_PATH)
|
||||
getMembers()
|
||||
initSock();
|
||||
if (await hasJoinedRoom()) {
|
||||
initSock();
|
||||
displayRoomView();
|
||||
|
||||
if (await isRoomOwner()) {
|
||||
|
Loading…
Reference in New Issue
Block a user