Buzzers now play the selection of each user, buzzers also displayed on user lists. Also added some new buzzers

This commit is contained in:
Samuel Kent
2023-01-01 15:33:37 +11:00
parent d5099f7a99
commit 355a2c8bf4
30 changed files with 50 additions and 44 deletions
+16 -14
View File
@@ -1,18 +1,18 @@
let buzzerOptions = ["Kirbeep","MPYosh","MPDog","MPCat","Wow","Ooh","MarioBoing","TheNumberEight","Mystery"];
function setupBuzzerOptions() {
// function setupBuzzerOptions() {
buzzerOptions.forEach((buzzerName) => {
$("#buzzerOptions").append("<img id='"+buzzerName+"' src='"+buzzerName+".png'>");
});
return buzzerOptions;
}
// buzzerOptions.forEach((buzzerName) => {
// $("#buzzerOptions").append("<img id='"+buzzerName+"' src='"+buzzerName+".png'>");
// });
// return buzzerOptions;
// }
function userInfoToClient(userInfo) {
$("#PlayersList").find("ul").html("");
$("#ChasersList").find("ul").html("");
for (const user in userInfo) {
const userId = user.replaceAll(" ","_");
$("#"+userInfo[user].teamName+"List").find("ul").append("<li id="+userId+">"+user+"<var></var></li>");
$("#"+userInfo[user].teamName+"List").find("ul").append("<li id="+userId+">"+"<img src="+userInfo[user].buzzerId+".png data-buzzerId="+userInfo[user].buzzerId+" class=userListBuzzerSelections>"+user+"<var></var></li>");
}
}
@@ -25,14 +25,16 @@ function gameStateToClient(currentTeam, currentScore) {
$("#currentScore").html(currentScore);
}
function buzzInfoToClient(buzzInfo, buzzerSound) {
function buzzInfoToClient(buzzInfo) {
//play sound for first buzz in
if ($("#firstBuzz").html() == "") {
buzzerSound.play();
$("#firstBuzz").html(buzzInfo[0].userName);
const userId = buzzInfo[0].userName.replaceAll(" ","_");
$("#userListPanel").find("#"+userId).css("font-weight", 900);
$("#userListPanel").find("#"+userId).find("var").html(" (BUZZ)")
// $("#userListPanel").find("#"+userId).css("font-weight", 900);
$("#userListPanel").find("#"+userId).find("var").html(" (BUZZ)");
let buzzerId = $("#userListPanel").find("#"+userId).find("img").attr("data-buzzerId")
let buzzerSound = new Audio(buzzerId+".wav");
buzzerSound.play();
}
for (let i=1; i < buzzInfo.length; i++) {
@@ -43,9 +45,9 @@ function buzzInfoToClient(buzzInfo, buzzerSound) {
function selectBuzzer(buzzerId) {
if (buzzerId == "Mystery") {
buzzerId = buzzerOptions[Math.floor(Math.random()*8)];
buzzerId = buzzerOptions[Math.floor(Math.random()*(buzzerOptions.length-1))];
}
buzzerSound = new Audio(buzzerId+".wav");
let buzzerSound = new Audio(buzzerId+".wav");
$("#buzzer").attr("src", buzzerId+".png" );
buzzerSound.play();
return buzzerSound;