diff --git a/app.js b/app.js index a3fbde7..6260b0e 100644 --- a/app.js +++ b/app.js @@ -14,10 +14,10 @@ const io = new Server(server, { const userMap = new Map(); let buzzInfo = []; +let idkList = []; let userInfo = new Object();//Each user has properties, and is stored as a property of userInfo let anyObjections = false; const teamsList = ["Players","Chasers"] - const teamsScore = [0,0]; let currentTeamNumber = 0; io.on("connection", (socket) => { @@ -55,6 +55,22 @@ io.on("connection", (socket) => { }); io.emit("buzzInfoToClient", buzzInfo); }); + + socket.on("idkButtonPressed", (newUserName) => { + if (!idkList.includes(newUserName) && userInfo[newUserName] != null && userInfo[newUserName].teamName == teamsList[currentTeamNumber]) { + idkList.push(newUserName); + let teamSize = 0; + for (const user in userInfo) { + if (userInfo[user].teamName == userInfo[newUserName].teamName) { + teamSize++; + } + } + io.emit("idkListToClient", idkList); + if (idkList.length >= teamSize) { + io.emit("passToClient", teamsList[currentTeamNumber]); + } + } + }); socket.on("scoresToServer", score => { teamsScore[currentTeamNumber] += score; @@ -63,9 +79,9 @@ io.on("connection", (socket) => { currentTeamNumber = (currentTeamNumber+1)%2; } buzzInfo = []; + idkList = []; io.emit("gameStateToClient", teamsList[currentTeamNumber], teamsScore[currentTeamNumber]); io.emit("clearBuzzers", teamsList[currentTeamNumber]); - io.emit("userInfoToClient", userInfo);//resets the buzzer info }); socket.on("updateUserInfo", (userName, teamName, buzzerId) => { diff --git a/audio/AoEWololo.wav b/audio/AoEWololo.wav new file mode 100644 index 0000000..1d11873 Binary files /dev/null and b/audio/AoEWololo.wav differ diff --git a/audio/Killer7Laugh.wav b/audio/Killer7Laugh.wav new file mode 100644 index 0000000..1486529 Binary files /dev/null and b/audio/Killer7Laugh.wav differ diff --git a/audio/MMShakeShake.wav b/audio/MMShakeShake.wav new file mode 100644 index 0000000..7c127f1 Binary files /dev/null and b/audio/MMShakeShake.wav differ diff --git a/audio/SF64Goodluck.wav b/audio/SF64Goodluck.wav new file mode 100644 index 0000000..f356eb8 Binary files /dev/null and b/audio/SF64Goodluck.wav differ diff --git a/audio/SonicCheckpoint.wav b/audio/SonicCheckpoint.wav new file mode 100644 index 0000000..e1e1489 Binary files /dev/null and b/audio/SonicCheckpoint.wav differ diff --git a/audio/SonicSusic.wav b/audio/SonicSusic.wav new file mode 100644 index 0000000..321f9eb Binary files /dev/null and b/audio/SonicSusic.wav differ diff --git a/audio/TAKamek.wav b/audio/TAKamek.wav new file mode 100644 index 0000000..d832d15 Binary files /dev/null and b/audio/TAKamek.wav differ diff --git a/browserFunctions.js b/browserFunctions.js index e152ca0..ec61a89 100644 --- a/browserFunctions.js +++ b/browserFunctions.js @@ -1,9 +1,16 @@ 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("
  • "+""+user+"
  • "); + console.log($("#userListPanel").find("#"+userId)); + if ($("#userListPanel").find("#"+userId).length >= 1) { + //update buzzer icon of existing user + $("#userListPanel").find("#"+userId).find("img").attr("data-buzzerId",userInfo[user].buzzerId); + $("#userListPanel").find("#"+userId).find("img").attr("src", userInfo[user].buzzerId+".png"); + } + else { + //new user + $("#"+userInfo[user].teamName+"List").find("ul").append("
  • "+""+user+"
  • "); + } } } @@ -16,12 +23,17 @@ function gameStateToClient(currentTeam, currentScore) { $("#currentScore").html(currentScore); } +function clearBuzzers() { + $("#firstBuzz").html(""); + $("#userListPanel").find("var").html(""); +} + function buzzInfoToClient(buzzInfo) { //play sound for first buzz in if ($("#firstBuzz").html() == "") { $("#firstBuzz").html(buzzInfo[0].userName); 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"); buzzerSound.play(); } @@ -33,6 +45,19 @@ function buzzInfoToClient(buzzInfo) { } } +function idkListToClient(idkList) { + idkList.forEach((userName) => { + const userId = userName.replaceAll(" ","_"); + $("#userListPanel").find("#"+userId).find("var").html("
    ¯\\\_(ツ)_/¯
    "); + }); +} + +function passToClient(teamName) { + let passSound = new Audio("PikminDeath.wav"); + passSound.play(); + $("#firstBuzz").html(teamName+" have Passed!"); +} + function selectBuzzer(buzzerId) { if (buzzerId == "Mystery") { buzzerId = buzzerOptions[Math.floor(Math.random()*(buzzerOptions.length-1))]; diff --git a/images/buzzers/AoEWololo.png b/images/buzzers/AoEWololo.png new file mode 100644 index 0000000..83279b0 Binary files /dev/null and b/images/buzzers/AoEWololo.png differ diff --git a/images/buzzers/Jiggluigibat.png b/images/buzzers/Jiggluigibat.png index 8dff965..2fe6a8a 100644 Binary files a/images/buzzers/Jiggluigibat.png and b/images/buzzers/Jiggluigibat.png differ diff --git a/images/buzzers/Killer7Laugh.png b/images/buzzers/Killer7Laugh.png new file mode 100644 index 0000000..a322c6e Binary files /dev/null and b/images/buzzers/Killer7Laugh.png differ diff --git a/images/buzzers/MMShakeShake.png b/images/buzzers/MMShakeShake.png new file mode 100644 index 0000000..8b0c2f7 Binary files /dev/null and b/images/buzzers/MMShakeShake.png differ diff --git a/images/buzzers/SonicCheckpoint.png b/images/buzzers/SonicCheckpoint.png new file mode 100644 index 0000000..7572c14 Binary files /dev/null and b/images/buzzers/SonicCheckpoint.png differ diff --git a/images/buzzers/SonicSusic.png b/images/buzzers/SonicSusic.png new file mode 100644 index 0000000..12919a3 Binary files /dev/null and b/images/buzzers/SonicSusic.png differ diff --git a/images/buzzers/TAKamek.png b/images/buzzers/TAKamek.png new file mode 100644 index 0000000..a735bb1 Binary files /dev/null and b/images/buzzers/TAKamek.png differ diff --git a/images/idkButton.png b/images/idkButton.png new file mode 100644 index 0000000..0f645e8 Binary files /dev/null and b/images/idkButton.png differ diff --git a/pages/home.html b/pages/home.html index e8c2e91..a4d7b10 100644 --- a/pages/home.html +++ b/pages/home.html @@ -1,7 +1,7 @@ - Now with more buzzers per buzzer! + Pledge Monolith! @@ -18,14 +18,22 @@ gameStateToClient(currentTeam, currentScore); }); - socket.on("clearBuzzers", () => { - $("#firstBuzz").html(""); + socket.on("clearBuzzers", (currentTeam) => { + clearBuzzers(); }); socket.on("buzzInfoToClient", (buzzInfo) => { buzzInfoToClient(buzzInfo); }); + socket.on("idkListToClient", (idkList) => { + idkListToClient(idkList); + }); + + socket.on("passToClient", (teamName) => { + passToClient(teamName); + }); + $("#plus0").click(function() { socket.emit("scoresToServer", 0); }); diff --git a/pages/play.html b/pages/play.html index fb678e0..5d06909 100644 --- a/pages/play.html +++ b/pages/play.html @@ -1,7 +1,7 @@ - Now with more buzzers per buzzer! + Pledge Monolith! @@ -15,7 +15,7 @@ let userName = queryString.searchParams.get("user"); $("#message").html("hi "+userName+" :]") let teamName = queryString.searchParams.get("team"); - let buzzerOptions = [["Kirbeep","KirbyMic2","KirbyMic3","KirbySquishy","KirbyBugzzy","KirbyKracko"],["MarioBoing","MarioPenguin","MarioCoin","MPYosh","MPDog","MPCat"],["EBWow","EBAttack1","SaturnHonk"],["Ooh"],["Jiggluigibat"],["AAHoldIt","AATakeThat"],["EmergencyMeeting"],["TheNumberEight"],["PikminThrow","PikminDeath"],["MGSAlert"],["FF9Moogle"],["P3Summon"],["HKAdido","HKShaw","HKGrub"],["DKOK"],["SonicOhNo"],["PdPSeren","TAFroggy"],["PKMNLvlUp"],["Mystery"]]; + let buzzerOptions = [["Kirbeep","KirbyMic2","KirbyMic3","KirbySquishy","KirbyBugzzy","KirbyKracko"],["MarioBoing","MarioPenguin","MarioCoin","MPYosh","MPDog","MPCat"],["P3Summon"],["EBWow","EBAttack1","SaturnHonk"],["Ooh"],["AAHoldIt","AATakeThat"],["Killer7Laugh"],["TheNumberEight"],["Jiggluigibat"],["FF9Moogle"],["EmergencyMeeting"],["PikminThrow"],["MGSAlert"],["HKAdido","HKShaw","HKGrub"],["DKOK"],["SonicCheckpoint","SonicOhNo","SonicSusic"],["PdPSeren","TAFroggy","TAKamek"],["PKMNLvlUp"],["MMShakeShake"],["AoEWololo"],["Mystery"]]; buzzerOptions.forEach((buzzerGroup) => { const groupFaceId = buzzerGroup[0]; const buzzerGroupHTML = $("
    "+buzzerGroup.length+" "); @@ -48,7 +48,7 @@ buzzable = false; $("#buzzer").css("opacity", "0.2"); } - $("#firstBuzz").html(""); + clearBuzzers(); }); socket.on("buzzInfoToClient", (buzzInfo) => { @@ -60,6 +60,14 @@ console.log("ping: "+ping); }); + socket.on("idkListToClient", (idkList) => { + idkListToClient(idkList); + }); + + socket.on("passToClient", (teamName) => { + passToClient(teamName); + }); + $(document).keydown(function(e) { if(e.which == 32) { buzzIn(); @@ -80,6 +88,16 @@ } } + $("#idkButton").mousedown(function() { + socket.emit("idkButtonPressed", userName); + }); + + $(document).keydown(function(e) { + if(e.which == 73 || e.which == 68 || e.which == 75) { + socket.emit("idkButtonPressed", userName); + } + }); + $(".buzzerGroup").mousedown(function() { $(".buzzerGroupItems").hide(); $(this).find(".buzzerGroupItems").show(); @@ -133,7 +151,13 @@ Click the buzzer above or press spacebar to buzz in.
    You can only buzz in on your team's turn. +
    +
    + Click the button below to let your team know you are willing to pass. +
    + You can also do this by pressing the I, D or K key.

    +
    diff --git a/styles/styleMain.css b/styles/styleMain.css index 30470de..2dadbcf 100644 --- a/styles/styleMain.css +++ b/styles/styleMain.css @@ -27,14 +27,14 @@ a, a:visited { #objection { left: 50%; margin-left: -250px; - min-height: 310px; + min-height: 100px; width: 500px; position: relative; } #objection img{ text-align: center; - width: 300px; + width: 200px; } #contestAnswer { @@ -75,6 +75,7 @@ a, a:visited { width: 400px; min-height: 170px; padding-left: 5px; + padding-bottom: 5px; } #ChasersList { @@ -84,6 +85,7 @@ a, a:visited { width: 400px; min-height: 170px; padding-left: 5px; + padding-bottom: 5px; } ul { @@ -190,6 +192,6 @@ ul { url('Twoson.woff') format('woff'), url('Twoson.ttf') format('truetype'); font-weight: normal; - font-style: italic; + /* font-style: italic; */ font-display: swap; } \ No newline at end of file