MAPG-204 clean up result sending

This commit is contained in:
bence committed 2021-04-03 18:24:43 +02:00
1 parent 7433813337
commit 9e5d20796c
4 files changed
+72 -79

No files matched your search

+11 -15
View File
@@ -66,10 +66,6 @@
Game.MultiConnector.newRound(json.data);
break;
case 'results':
//TODO
break;
case 'guess':
//TODO
break;
@@ -94,9 +90,9 @@
if (data.history) {
for (var i = 0; i < data.history.length; ++i) {
var round = data.history[i];
Game.rounds.push({ position: round.position, guessPosition: round.guessPosition, realMarker: null, guessMarker: null, line: null });
Game.addRealGuessPair(round.position, round.guessPosition, true);
Game.scoreSum += round.score;
Game.rounds.push({ position: round.position, guessPosition: round.result.guessPosition, realMarker: null, guessMarker: null, line: null });
Game.addRealGuessPair(round.position, round.result.guessPosition, true);
Game.scoreSum += round.result.score;
}
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
@@ -234,9 +230,9 @@
if (this.response.history) {
for (var i = 0; i < this.response.history.length; ++i) {
var round = this.response.history[i];
Game.rounds.push({ position: round.position, guessPosition: round.guessPosition, realMarker: null, guessMarker: null, line: null });
Game.addRealGuessPair(round.position, round.guessPosition, true);
Game.scoreSum += round.score;
Game.rounds.push({ position: round.position, guessPosition: round.result.guessPosition, realMarker: null, guessMarker: null, line: null });
Game.addRealGuessPair(round.position, round.result.guessPosition, true);
Game.scoreSum += round.result.score;
}
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
@@ -356,7 +352,7 @@
Game.panorama.setPano(panoId);
},
evaluateGuess: function () {
guess: function () {
if (!Game.guessMarker) {
return;
}
@@ -392,11 +388,11 @@
Game.scoreSum += this.response.result.score;
document.getElementById('currentScoreSum').innerHTML = String(Game.scoreSum) + '/' + String(Game.rounds.length * Game.MAX_SCORE);
Game.rounds[Game.rounds.length - 1].position = this.response.result.position;
Game.addRealGuessPair(this.response.result.position, guessPosition);
Game.rounds[Game.rounds.length - 1].position = this.response.position;
Game.addRealGuessPair(this.response.position, guessPosition);
var resultBounds = new google.maps.LatLngBounds();
resultBounds.extend(this.response.result.position);
resultBounds.extend(this.response.position);
resultBounds.extend(guessPosition);
Game.map.setOptions({
@@ -687,7 +683,7 @@
}
document.getElementById('guessButton').onclick = function () {
Game.evaluateGuess();
Game.guess();
}
document.getElementById('continueButton').onclick = function () {