diff --git a/app.js b/app.js index bf2458b..cc0d23f 100644 --- a/app.js +++ b/app.js @@ -16,10 +16,10 @@ const io = new Server(server, { const userMap = new Map(); let buzzInfo = []; 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] +const teamsScore = [0,0]; let currentTeamNumber = 0; io.on("connection", (socket) => { console.log("a user connected"); @@ -31,6 +31,10 @@ io.on("connection", (socket) => { //initial info on connection socket.emit("gameStateToClient", teamsList[currentTeamNumber], teamsScore[currentTeamNumber]); + if (anyObjections == true) { + socket.emit("objectionToClient", "????"); + } + socket.on("pingServer", (timeStamp) => { socket.emit("pingClient", timeStamp); }); @@ -84,10 +88,22 @@ io.on("connection", (socket) => { }); socket.on("unregisterUsers", () => { + // console.log("whaat?"); userInfo = new Object(); io.emit("userInfoToClient", userInfo); }); + socket.on("objectionToServer", (userName) => { + if (anyObjections == false) { + io.emit("objectionToClient", userName); + anyObjections = true; + } + }); + + socket.on("clearObjectionToServer", () => { + anyObjections = false; + io.emit("clearObjectionToClient"); + }); }); // const io = new Server(server); diff --git a/audio/AAObjection.wav b/audio/AAObjection.wav new file mode 100644 index 0000000..6b3ed3a Binary files /dev/null and b/audio/AAObjection.wav differ diff --git a/audio/FF9Moogle.wav b/audio/FF9Moogle.wav new file mode 100644 index 0000000..d01f055 Binary files /dev/null and b/audio/FF9Moogle.wav differ diff --git a/audio/MGSAlert.wav b/audio/MGSAlert.wav new file mode 100644 index 0000000..e6e4bd3 Binary files /dev/null and b/audio/MGSAlert.wav differ diff --git a/audio/MarioCoin.wav b/audio/MarioCoin.wav new file mode 100644 index 0000000..fef4191 Binary files /dev/null and b/audio/MarioCoin.wav differ diff --git a/audio/PikminThrow.wav b/audio/PikminThrow.wav new file mode 100644 index 0000000..229d884 Binary files /dev/null and b/audio/PikminThrow.wav differ diff --git a/browserFunctions.js b/browserFunctions.js index 98e7536..bc861d4 100644 --- a/browserFunctions.js +++ b/browserFunctions.js @@ -43,4 +43,14 @@ function selectBuzzer(buzzerId) { $("#buzzer").attr("src", buzzerId+".png" ); buzzerSound.play(); return buzzerSound; +} + +let objectionSound = new Audio("AAObjection.wav"); +function objectionToClient(userName) { + objectionSound.play(); + $("#objection").html("
"+userName+" is objecting!
"); +} + +function clearObjectionToClient() { + $("#objection").html(""); } \ No newline at end of file diff --git a/images/AAEvidence.gif b/images/AAEvidence.gif new file mode 100644 index 0000000..8aac87a Binary files /dev/null and b/images/AAEvidence.gif differ diff --git a/images/AAEvidence.png b/images/AAEvidence.png new file mode 100644 index 0000000..285491f Binary files /dev/null and b/images/AAEvidence.png differ diff --git a/images/AAObjection.gif b/images/AAObjection.gif new file mode 100644 index 0000000..3c0a938 Binary files /dev/null and b/images/AAObjection.gif differ diff --git a/images/AAObjection.png b/images/AAObjection.png new file mode 100644 index 0000000..1d954af Binary files /dev/null and b/images/AAObjection.png differ diff --git a/images/EmergencyMeeting.psd b/images/EmergencyMeeting.psd deleted file mode 100644 index 2c1e76d..0000000 Binary files a/images/EmergencyMeeting.psd and /dev/null differ diff --git a/images/TurnVisual.psd b/images/TurnVisual.psd deleted file mode 100644 index aef4d7f..0000000 Binary files a/images/TurnVisual.psd and /dev/null differ diff --git a/images/buzzers/FF9Moogle.png b/images/buzzers/FF9Moogle.png new file mode 100644 index 0000000..5e63e2f Binary files /dev/null and b/images/buzzers/FF9Moogle.png differ diff --git a/images/buzzers/MGSAlert.png b/images/buzzers/MGSAlert.png new file mode 100644 index 0000000..88974dd Binary files /dev/null and b/images/buzzers/MGSAlert.png differ diff --git a/images/buzzers/MarioCoin.png b/images/buzzers/MarioCoin.png new file mode 100644 index 0000000..2f3dd3a Binary files /dev/null and b/images/buzzers/MarioCoin.png differ diff --git a/images/buzzers/PikminThrow.png b/images/buzzers/PikminThrow.png new file mode 100644 index 0000000..a80aee9 Binary files /dev/null and b/images/buzzers/PikminThrow.png differ diff --git a/pages/host.html b/pages/host.html index 6441fb7..1b7577f 100644 --- a/pages/host.html +++ b/pages/host.html @@ -38,7 +38,19 @@ }); $("#unregisterUsers").click(function() { - socket.emit("unregisterUsers", 2); + socket.emit("unregisterUsers"); + }); + + socket.on("objectionToClient", (userName) => { + objectionToClient(userName); + $("#objection").append(""); + $("#clearObjection").click(function() { + socket.emit("clearObjectionToServer"); + }); + }); + + socket.on("clearObjectionToClient", () => { + clearObjectionToClient(); }); }); @@ -56,9 +68,15 @@

(all points buttons clear buzzers)

-


+

+

+
+
+
+
+
diff --git a/pages/play.html b/pages/play.html index 1651ea9..b0c0ef1 100644 --- a/pages/play.html +++ b/pages/play.html @@ -17,7 +17,7 @@ $("#message").html("hi "+userName+" :]") let teamName = queryString.searchParams.get("team"); - let buzzerOptions = ["Kirbeep","MPYosh","MPDog","MPCat","EBWow","Ooh","MarioBoing","TheNumberEight","EBAttack1","SaturnHonk","PuffRest","AAHoldIt","EmergencyMeeting","Mystery"]; + let buzzerOptions = ["Kirbeep","MPYosh","MPDog","MPCat","EBWow","EBAttack1","Ooh","TheNumberEight","MarioBoing","MarioCoin","SaturnHonk","PuffRest","AAHoldIt","EmergencyMeeting","PikminThrow","MGSAlert","FF9Moogle","Mystery"]; buzzerOptions.forEach((buzzerId) => { $("#buzzerOptions").append(""); }); @@ -86,6 +86,26 @@ $("#buzzer").attr("src", buzzerId+".png" ); buzzerSound.play(); }); + + $("#contestAnswer").find("img").mousedown(function() { + socket.emit("objectionToServer", userName); + }); + + $("#contestAnswer").find("img").hover( + function() { + $(this).attr("src", "AAEvidence.gif"); + }, function() { + $(this).attr("src", "AAEvidence.png"); + } + ); + + socket.on("objectionToClient", (userName) => { + objectionToClient(userName); + }); + + socket.on("clearObjectionToClient", () => { + clearObjectionToClient(); + }); }); @@ -99,6 +119,8 @@ The buzzer

+
+
@@ -112,5 +134,14 @@
+
+ +

+ Click to contest an answer marked incorrectly. +
+ (please use sparingly) +

+
+ diff --git a/styles/styleMain.css b/styles/styleMain.css index 7f993c1..04163c9 100644 --- a/styles/styleMain.css +++ b/styles/styleMain.css @@ -10,6 +10,8 @@ body { button { font-family: 'Twoson'; + position: relative; + z-index: 1; } input { @@ -20,7 +22,43 @@ a, a:visited { color: rgb(199, 147, 255); } +#firstBuzz { + min-height: 30px; +} + +#objection { + left: 50%; + margin-left: -250px; + min-height: 310px; + width: 500px; + position: relative; + /* bottom: 150px; */ +} + +#objection img{ + text-align: center; + width: 300px; +} + +#contestAnswer { + position: absolute; + right: 50px; + bottom: 50px; + text-align: center; + width: 200px; +} +#contestAnswer img { + width: 100px; +} + +#contestAnswer p { + margin: 0px; + font-size: 12px; + border: dashed; +} + #interface { + z-index: -1; text-align: center; } @@ -95,6 +133,20 @@ ul { } @media (max-width: 600px) { + #objection { + margin-left: 0px; + left: -65px; + bottom: 150px; + font-size: 15px; + text-align: left; + min-height: 0px; + height: 0px; + } + + #objection img{ + width: 150px; + /* text-align: left; */ + } #userListPanel { top: 80px; width: 500px;