MAPG-213 send round data at initialization if user guessed
This commit is contained in:
parent
3abdb6910e
commit
6342bb1e79
@ -165,9 +165,18 @@ class MultiGame {
|
||||
}
|
||||
|
||||
_endRound(room, round) {
|
||||
var data = { position: round.place.position, allResults: this._collectResultsInRound(room, round) };
|
||||
var allResults = this._collectResultsInRound(room, round);
|
||||
var self = this;
|
||||
room.members.forEach(function (member) {
|
||||
room.members.forEach(function (member, token) {
|
||||
var result = { guessPosition: null, distance: null, score: 0 };
|
||||
|
||||
if (round.results.has(token)) {
|
||||
result = round.results.get(token);
|
||||
} else {
|
||||
round.results.set(token, result);
|
||||
}
|
||||
|
||||
var data = { position: round.place.position, result: result, allResults: allResults };
|
||||
self._sendToMember(member, 'end_round', data);
|
||||
});
|
||||
}
|
||||
@ -183,9 +192,13 @@ class MultiGame {
|
||||
}
|
||||
|
||||
data.history = [];
|
||||
for (var i = 0; i < room.currentRound; ++i) {
|
||||
for (var i = 0; i <= room.currentRound; ++i) {
|
||||
var round = room.rounds[i];
|
||||
|
||||
if (i === room.currentRound && !round.results.has(token)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var result = { guessPosition: null, distance: null, score: 0 };
|
||||
var allResults = [];
|
||||
|
||||
@ -210,6 +223,8 @@ class MultiGame {
|
||||
data.members.push({ userName: currentMember.userName, me: member === currentMember });
|
||||
});
|
||||
|
||||
data.readyToContinue = room.currentRound >= 0 && room.members.size === room.rounds[room.currentRound].results.size
|
||||
|
||||
this._sendToMember(member, 'initialize', data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user