storing how many players are in queue

This commit is contained in:
Jack 2021-04-11 19:54:32 +01:00
parent 9afba5778a
commit 6cde0b470b

View file

@ -1,5 +1,7 @@
import * as Tribe from "./tribe";
export let inQueueNumbers = [0, 0, 0, 0];
export function showLoading() {
$(".pageTribe .prelobby .welcome .onlineStatsLoader").removeClass("hidden");
}
@ -8,6 +10,34 @@ export function hideLoading() {
$(".pageTribe .prelobby .welcome .onlineStatsLoader").addClass("hidden");
}
export function incrementQueues(queues) {
queues.forEach((queue) => {
inQueueNumbers[queue]++;
});
updateQueueButtons();
}
export function decrementQueues(queues) {
queues.forEach((queue) => {
inQueueNumbers[queue]--;
});
updateQueueButtons();
}
export function setInQueue(newNum) {
inQueueNumbers = newNum;
updateQueueButtons();
}
export function updateQueueButtons() {
let buttons = $(".pageTribe .prelobby .matchmaking .buttons .button");
inQueueNumbers.forEach((num, index) => {
$(buttons[index])
.find(".subtext")
.text("In queue: " + num);
});
}
export function refresh() {
showLoading();
Tribe.socket.emit("mp_get_online_stats");