MAPG-235 time limit restriction for the whole game feature added
This commit is contained in:
parent
c2df9b7713
commit
b78d564f6f
@ -341,6 +341,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
|
|||||||
},
|
},
|
||||||
|
|
||||||
disableRestrictions: function () {
|
disableRestrictions: function () {
|
||||||
|
|
||||||
Game.panorama.setOptions({
|
Game.panorama.setOptions({
|
||||||
clickToGo: true,
|
clickToGo: true,
|
||||||
linksControl: true,
|
linksControl: true,
|
||||||
@ -350,6 +351,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
|
|||||||
document.getElementById('panningBlockerCover').style.display = null;
|
document.getElementById('panningBlockerCover').style.display = null;
|
||||||
|
|
||||||
Game.startCountdown(0);
|
Game.startCountdown(0);
|
||||||
|
Game.timeoutEnd = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
transitToResultMap: function () {
|
transitToResultMap: function () {
|
||||||
@ -650,10 +652,15 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
|
|||||||
|
|
||||||
guess: function () {
|
guess: function () {
|
||||||
|
|
||||||
Game.disableRestrictions();
|
|
||||||
|
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
|
|
||||||
|
if (Game.timeoutEnd) {
|
||||||
|
var timeLeft = Math.ceil((Game.timeoutEnd - new Date()) / 1000);
|
||||||
|
data.append('timeLeft', timeLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
Game.disableRestrictions();
|
||||||
|
|
||||||
if (Game.guessMarker) {
|
if (Game.guessMarker) {
|
||||||
var guessPosition = Game.guessMarker.getPosition().toJSON();
|
var guessPosition = Game.guessMarker.getPosition().toJSON();
|
||||||
Game.rounds[Game.rounds.length - 1].guessPosition = guessPosition;
|
Game.rounds[Game.rounds.length - 1].guessPosition = guessPosition;
|
||||||
|
@ -381,9 +381,19 @@ class GameFlowController
|
|||||||
$response['result'] = ['distance' => null, 'score' => 0];
|
$response['result'] = ['distance' => null, 'score' => 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save user relevant state of challenge
|
||||||
$userInChallenge->setCurrentRound($nextRound);
|
$userInChallenge->setCurrentRound($nextRound);
|
||||||
|
if ($this->request->post('timeLeft')) {
|
||||||
|
$userInChallenge->setTimeLeft(intval($this->request->post('timeLeft')));
|
||||||
|
}
|
||||||
$this->pdm->saveToDb($userInChallenge);
|
$this->pdm->saveToDb($userInChallenge);
|
||||||
|
|
||||||
|
|
||||||
|
if ($challenge->getTimeLimitType() === 'game' && $this->request->post('timeLeft')) {
|
||||||
|
$timeLimit = max(10, intval($this->request->post('timeLeft')));
|
||||||
|
$response['restrictions']['timeLimit'] = $timeLimit * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($response['history'][$currentRound]['allResults'])) {
|
if(isset($response['history'][$currentRound]['allResults'])) {
|
||||||
$response['allResults'] = $response['history'][$currentRound]['allResults'];
|
$response['allResults'] = $response['history'][$currentRound]['allResults'];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user