MAPG-219 disable continue button until round is over
All checks were successful
default-pipeline default-pipeline #84
All checks were successful
default-pipeline default-pipeline #84
This commit is contained in:
parent
a2f2080959
commit
be40acdb2d
@ -17,6 +17,7 @@
|
|||||||
adaptGuess: false,
|
adaptGuess: false,
|
||||||
googleLink: null,
|
googleLink: null,
|
||||||
|
|
||||||
|
readyToContinue: false,
|
||||||
timeoutEnd: null,
|
timeoutEnd: null,
|
||||||
countdownHandler: null,
|
countdownHandler: null,
|
||||||
|
|
||||||
@ -121,6 +122,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.place) {
|
if (data.place) {
|
||||||
|
Game.readyToContinue = false;
|
||||||
Game.panoId = data.place.panoId;
|
Game.panoId = data.place.panoId;
|
||||||
Game.pov = data.place.pov;
|
Game.pov = data.place.pov;
|
||||||
|
|
||||||
@ -156,6 +158,7 @@
|
|||||||
Game.reset();
|
Game.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game.readyToContinue = false;
|
||||||
Game.panoId = data.place.panoId;
|
Game.panoId = data.place.panoId;
|
||||||
Game.pov = data.place.pov;
|
Game.pov = data.place.pov;
|
||||||
|
|
||||||
@ -180,6 +183,18 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
endRound: function (data) {
|
endRound: function (data) {
|
||||||
|
Game.readyToContinue = true;
|
||||||
|
Game.startCountdown(0);
|
||||||
|
|
||||||
|
if (Game.rounds[Game.rounds.length - 1].guessPosition || Game.rounds[Game.rounds.length - 1].position) {
|
||||||
|
if (Game.multi.owner) {
|
||||||
|
document.getElementById('continueButton').disabled = false;
|
||||||
|
document.getElementById('startNewGameButton').disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: refactor - it is necessary for mobile
|
// TODO: refactor - it is necessary for mobile
|
||||||
if (window.getComputedStyle(document.getElementById('guess')).visibility === 'hidden') {
|
if (window.getComputedStyle(document.getElementById('guess')).visibility === 'hidden') {
|
||||||
document.getElementById('showGuessButton').click();
|
document.getElementById('showGuessButton').click();
|
||||||
@ -189,10 +204,6 @@
|
|||||||
document.getElementById('panoCover').style.visibility = 'visible';
|
document.getElementById('panoCover').style.visibility = 'visible';
|
||||||
|
|
||||||
Game.showResults(data.position, null, { distance: NaN, score: 0 }, data.allResults);
|
Game.showResults(data.position, null, { distance: NaN, score: 0 }, data.allResults);
|
||||||
|
|
||||||
if (!Game.multi.owner) {
|
|
||||||
document.getElementById('continueButton').style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -463,6 +474,14 @@
|
|||||||
if (Game.rounds.length === Game.NUMBER_OF_ROUNDS) {
|
if (Game.rounds.length === Game.NUMBER_OF_ROUNDS) {
|
||||||
document.getElementById('continueButton').style.display = 'none';
|
document.getElementById('continueButton').style.display = 'none';
|
||||||
document.getElementById('showSummaryButton').style.display = 'block';
|
document.getElementById('showSummaryButton').style.display = 'block';
|
||||||
|
} else if (roomId) {
|
||||||
|
if (Game.multi.owner) {
|
||||||
|
if (!Game.readyToContinue) {
|
||||||
|
document.getElementById('continueButton').disabled = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.getElementById('continueButton').style.display = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -496,10 +515,6 @@
|
|||||||
if (this.response.place) {
|
if (this.response.place) {
|
||||||
Game.panoId = this.response.place.panoId;
|
Game.panoId = this.response.place.panoId;
|
||||||
Game.pov = this.response.place.pov;
|
Game.pov = this.response.place.pov;
|
||||||
} else {
|
|
||||||
if (!Game.multi.owner) {
|
|
||||||
document.getElementById('continueButton').style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, data);
|
}, data);
|
||||||
},
|
},
|
||||||
@ -625,6 +640,9 @@
|
|||||||
|
|
||||||
if (!roomId || Game.multi.owner) {
|
if (!roomId || Game.multi.owner) {
|
||||||
document.getElementById('startNewGameButton').style.display = 'block';
|
document.getElementById('startNewGameButton').style.display = 'block';
|
||||||
|
if (!Game.readyToContinue) {
|
||||||
|
document.getElementById('startNewGameButton').disabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var resultBounds = new google.maps.LatLngBounds();
|
var resultBounds = new google.maps.LatLngBounds();
|
||||||
@ -694,6 +712,10 @@
|
|||||||
clearInterval(Game.countdownHandler);
|
clearInterval(Game.countdownHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeout <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Game.timeoutEnd = new Date(new Date().getTime() + timeout);
|
Game.timeoutEnd = new Date(new Date().getTime() + timeout);
|
||||||
Game.countdownElement = document.getElementById('countdown');
|
Game.countdownElement = document.getElementById('countdown');
|
||||||
Game.countdownTimeElement = document.getElementById('countdownTime');
|
Game.countdownTimeElement = document.getElementById('countdownTime');
|
||||||
@ -758,7 +780,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
Game.map.addListener('click', function (e) {
|
Game.map.addListener('click', function (e) {
|
||||||
if (Game.rounds[Game.rounds.length - 1].guessPosition) {
|
if (Game.rounds[Game.rounds.length - 1].guessPosition || Game.rounds[Game.rounds.length - 1].position) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +848,7 @@
|
|||||||
|
|
||||||
document.getElementById('continueButton').onclick = function () {
|
document.getElementById('continueButton').onclick = function () {
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
if (!Game.multi.owner) {
|
if (!Game.multi.owner || !Game.readyToContinue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user