Compare commits

..

No commits in common. "1c1e5f051d61d7bb70818d3c13fea8a09165a010" and "79709276547db27bcd2ea7153bdbdbe8039bf8b7" have entirely different histories.

3 changed files with 22 additions and 13 deletions

View File

@ -21,6 +21,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
googleLink: null, googleLink: null,
history: [], history: [],
restrictions: null, restrictions: null,
finishers: null,
readyToContinue: true, readyToContinue: true,
timeoutEnd: null, timeoutEnd: null,
@ -487,6 +488,10 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
} }
} }
} }
if (response.finishers) {
Game.finishers = new Set(response.finishers);
}
}, },
reset: function () { reset: function () {
@ -539,6 +544,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
document.getElementById('panningBlockerCover').style.display = null; document.getElementById('panningBlockerCover').style.display = null;
Game.history = []; Game.history = [];
Game.finishers = null;
Game.initialize(); Game.initialize();
}, },
@ -867,21 +873,16 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
var highscores = new Map(); var highscores = new Map();
highscores.set('me', Game.scoreSum); highscores.set('me', Game.scoreSum);
// collect the results of users who are through the last round for (var i = 0; i < Game.history.length; ++i) {
const round = Game.history[Game.history.length - 1];
if (round.allResults) {
for (const result of round.allResults) {
highscores.set(result.userName, result.score);
}
}
// add up scores only for the finishers
for (var i = Game.history.length - 2; i >= 0; --i) {
const round = Game.history[i]; const round = Game.history[i];
if (round.allResults) { if (round.allResults) {
for (const result of round.allResults) { for (const result of round.allResults) {
if (highscores.has(result.userName)) { if (Game.finishers.has(result.userName)) {
highscores.set(result.userName, highscores.get(result.userName) + result.score); if (highscores.has(result.userName)) {
highscores.set(result.userName, highscores.get(result.userName) + result.score);
} else {
highscores.set(result.userName, result.score);
}
} }
} }
} }

View File

@ -199,6 +199,14 @@ class GameFlowController implements ISecured
if (!isset($currentPlace)) { // game finished if (!isset($currentPlace)) { // game finished
$response['finished'] = true; $response['finished'] = true;
// list all players who finished the challenge
$response['finishers'] = [];
foreach ($this->userInChallengeRepository->getAllByChallengeWithUsers($challenge) as $userInChallenge) {
if ($userInChallenge->getCurrentRound() == $currentRound && $userInChallenge->getUser()->getId() != $userId) {
$response['finishers'][] = $userInChallenge->getUser()->getDisplayName();
}
}
} else { // continue game } else { // continue game
$response['place'] = [ $response['place'] = [
'panoId' => $currentPlace->getPanoIdCached(), 'panoId' => $currentPlace->getPanoIdCached(),

View File

@ -67,7 +67,7 @@ TODO: condition!
</div> </div>
<div> <div>
<input type="checkbox" id="noZoom" name="noZoom" value="noZoom" /> <input type="checkbox" id="noZoom" name="noZoom" value="noZoom" />
<label for="noZoom">No zoom allowed</label> <label for="noMove">No zoom allowed</label>
</div> </div>
<div> <div>
<input type="checkbox" id="noPan" name="noPan" value="noPan" /> <input type="checkbox" id="noPan" name="noPan" value="noPan" />