not searching if no queues are selected, removed notification

This commit is contained in:
Jack 2021-04-07 21:11:49 +01:00
parent 4d63964daa
commit b7ee30ea69
2 changed files with 16 additions and 2 deletions

View file

@ -69,11 +69,22 @@ function refreshQueueButtons() {
buttons.removeClass("active");
let atleastone = false;
queues.forEach((queue, id) => {
if (queue) {
atleastone = true;
$(buttons[id]).addClass("active");
}
});
if (!atleastone) {
$(".pageTribe .prelobby .matchmaking .startMatchmakingButton").addClass(
"disabled"
);
} else {
$(".pageTribe .prelobby .matchmaking .startMatchmakingButton").removeClass(
"disabled"
);
}
}
export function getQ() {

View file

@ -1502,7 +1502,7 @@ socket.on("mp_room_test_init", (data) => {
socket.on("mp_room_state_update", (data) => {
state = data.newState;
Notifications.add(`state changed to ${data.newState}`, 0);
// Notifications.add(`state changed to ${data.newState}`, 0);
if (data.newState === 8) {
Matchmaking.hideLeaveQueueButton();
}
@ -1978,6 +1978,7 @@ $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").click((e) => {
if (state >= 6 && state <= 8) return;
if ($(e.currentTarget).hasClass("disabled")) return;
let queue = Matchmaking.getQ();
if (queue.length == 0) return;
Matchmaking.setBannerText("Searching for a room...");
Matchmaking.showBanner();
state = 6;
@ -1994,6 +1995,8 @@ $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").click((e) => {
$(".pageTest #result #queueAgainButton").click((e) => {
if (state >= 6 && state <= 8) return;
if ($(e.currentTarget).hasClass("disabled")) return;
let queue = Matchmaking.getQ();
if (queue.length == 0) return;
Matchmaking.setBannerText("Searching for a room...");
Matchmaking.showBanner();
showHideTribeDiff(false);
@ -2003,7 +2006,7 @@ $(".pageTest #result #queueAgainButton").click((e) => {
Matchmaking.disableLobbyButtons();
Matchmaking.hideStartQueueButton();
setTimeout(() => {
socket.emit("mp_room_join", { queue: Matchmaking.getQ() });
socket.emit("mp_room_join", { queue: queue });
Matchmaking.showLeaveQueueButton();
resetResult();
}, 1000);