Turned buzzer sounds off for players by default

This commit is contained in:
Samuel Kent
2023-10-05 19:04:59 +11:00
parent 3824c3181c
commit 56f0a2b948
5 changed files with 21 additions and 14 deletions
+1 -3
View File
@@ -139,6 +139,4 @@ assetFolders.forEach((folderName) => {
response.sendFile(folderName+"/"+fileName, {root: __dirname }); response.sendFile(folderName+"/"+fileName, {root: __dirname });
}); });
}); });
}); });
+8 -4
View File
@@ -27,14 +27,16 @@ function clearBuzzers() {
$("#userListPanel").find("var").html(""); $("#userListPanel").find("var").html("");
} }
function buzzInfoToClient(buzzInfo) { function buzzInfoToClient(buzzInfo, soundOn) {
//play sound for first buzz in //play sound for first buzz in
if ($("#firstBuzz").html() == "") { if ($("#firstBuzz").html() == "") {
$("#firstBuzz").html(buzzInfo[0].userName); $("#firstBuzz").html(buzzInfo[0].userName);
const userId = buzzInfo[0].userName.replaceAll(" ","_"); const userId = buzzInfo[0].userName.replaceAll(" ","_");
let buzzerId = $("#userListPanel").find("#"+userId).find("img").attr("data-buzzerId"); let buzzerId = $("#userListPanel").find("#"+userId).find("img").attr("data-buzzerId");
let buzzerSound = new Audio(buzzerId+".wav"); let buzzerSound = new Audio(buzzerId+".wav");
buzzerSound.play(); if (soundOn == true) {
buzzerSound.play();
}
} }
for (let i=0; i < buzzInfo.length; i++) { for (let i=0; i < buzzInfo.length; i++) {
@@ -51,9 +53,11 @@ function idkListToClient(idkList) {
}); });
} }
function passToClient(teamName) { function passToClient(teamName, soundOn) {
let passSound = new Audio("PikminDeath.wav"); let passSound = new Audio("PikminDeath.wav");
passSound.play(); if (soundOn == true) {
passSound.play();
}
$("#firstBuzz").html(teamName+" have Passed!"); $("#firstBuzz").html(teamName+" have Passed!");
} }
+1 -1
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Thanks for pledging Star of Providence! :)</title> <title>Submit Kuru Kuru Kururin to the chase ty</title>
<link rel="stylesheet" href="styleMain.css"> <link rel="stylesheet" href="styleMain.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script> <script>
+3 -3
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Thanks for pledging Star of Providence! :)</title> <title>Submit Kuru Kuru Kururin to the chase ty</title>
<link rel="stylesheet" href="styleMain.css"> <link rel="stylesheet" href="styleMain.css">
<script src="browserFunctions.js"></script> <script src="browserFunctions.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
@@ -23,7 +23,7 @@
}); });
socket.on("buzzInfoToClient", (buzzInfo) => { socket.on("buzzInfoToClient", (buzzInfo) => {
buzzInfoToClient(buzzInfo); buzzInfoToClient(buzzInfo, true);
}); });
socket.on("idkListToClient", (idkList) => { socket.on("idkListToClient", (idkList) => {
@@ -31,7 +31,7 @@
}); });
socket.on("passToClient", (teamName) => { socket.on("passToClient", (teamName) => {
passToClient(teamName); passToClient(teamName, true);
}); });
$("#plus0").click(function() { $("#plus0").click(function() {
+8 -3
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Thanks for pledging Star of Providence! :)</title> <title>Submit Kuru Kuru Kururin to the chase ty</title>
<link rel="stylesheet" href="styleMain.css"> <link rel="stylesheet" href="styleMain.css">
<script src="browserFunctions.js"></script> <script src="browserFunctions.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
@@ -16,6 +16,7 @@
$("#message").html("hi "+userName+" :]") $("#message").html("hi "+userName+" :]")
let teamName = queryString.searchParams.get("team"); let teamName = queryString.searchParams.get("team");
let clientBuzzer = "Kirbeep";//this is mostly just used as a reference for if they have a special buzzer let clientBuzzer = "Kirbeep";//this is mostly just used as a reference for if they have a special buzzer
let buzzerSoundsOn = false;
let buzzerOptions = [ let buzzerOptions = [
["Kirbeep","KirbyMic2","KirbySquishy","KirbyBugzzy","KirbyKracko"], ["Kirbeep","KirbyMic2","KirbySquishy","KirbyBugzzy","KirbyKracko"],
["MarioBoing","MarioPenguin","MarioCoin","MPYosh","MPDogF","MPCatF","MarioPlum","WLHelloThere","WLAlright","WLHurryUp","WLOhBoy"], ["MarioBoing","MarioPenguin","MarioCoin","MPYosh","MPDogF","MPCatF","MarioPlum","WLHelloThere","WLAlright","WLHurryUp","WLOhBoy"],
@@ -153,7 +154,7 @@
}); });
socket.on("buzzInfoToClient", (buzzInfo) => { socket.on("buzzInfoToClient", (buzzInfo) => {
buzzInfoToClient(buzzInfo); buzzInfoToClient(buzzInfo, buzzerSoundsOn);
}); });
socket.on("pingClient", (timeStamp) => { socket.on("pingClient", (timeStamp) => {
@@ -166,7 +167,7 @@
}); });
socket.on("passToClient", (teamName) => { socket.on("passToClient", (teamName) => {
passToClient(teamName); passToClient(teamName, buzzerSoundsOn);
}); });
$(document).keydown(function(e) { $(document).keydown(function(e) {
@@ -244,6 +245,10 @@
clientBuzzer = buzzerId; clientBuzzer = buzzerId;
socket.emit("updateUserInfo", userName, teamName, buzzerId); socket.emit("updateUserInfo", userName, teamName, buzzerId);
} }
window.mute = function() {
buzzerSoundsOn = !buzzerSoundsOn;
console.log("buzzerSoundsOn: "+buzzerSoundsOn);
}
}); });
</script> </script>
</head> </head>