userlist now provides buzzer info

This commit is contained in:
Samuel Kent
2022-12-27 16:07:41 +11:00
parent 252fa97606
commit 221414aff4
5 changed files with 68 additions and 80 deletions
+17 -13
View File
@@ -5,26 +5,30 @@ function setupBuzzerOptions() {
});
return buzzerOptions;
}
function userListsToClient(playerList, chaserList) {
$("#playerList").html("");
$("#chaserList").html("");
playerList.forEach((playerName) => {
$("#playerList").append("<li>"+playerName+"</li>");
});
chaserList.forEach((chaserName) => {
$("#chaserList").append("<li>"+chaserName+"</li>");
});
function userInfoToClient(userInfo) {
$("#PlayersList").html("");
$("#ChasersList").html("");
for (const user in userInfo) {
$("#"+userInfo[user].teamName+"List").append("<li id="+user+">"+user+"<var></var></li>");
}
}
function gameStateToClient(currentTeam, currentScore) {
$("#currentTeam").html(currentTeam);
$("#currentTeam").html(currentTeam+" turn");
$("#currentScore").html(currentScore);
}
function buzzListToClient(buzzList, buzzerSound) {
function buzzInfoToClient(buzzInfo, buzzerSound) {
//play sound for first buzz in
if ($("#buzzList").html() == "") {
if (buzzInfo.length == 1) {
buzzerSound.play();
$("#firstBuzz").html(buzzInfo[0].userName);
$("#userListPanel").find("#"+buzzInfo[0].userName).css("font-weight", 900);
$("#userListPanel").find("#"+buzzInfo[0].userName).find("var").html(" (BUZZ)")
}
$("#buzzList").html(buzzList.join());
for (let i=1; i < buzzInfo.length; i++) {
$("#userListPanel").find("#"+buzzInfo[i].userName).find("var").html(" ("+buzzInfo[i].lateTime/1000+")");
}
}