mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-29 03:20:46 +08:00
storing how many players are in queue
This commit is contained in:
parent
9afba5778a
commit
6cde0b470b
1 changed files with 30 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue