Skip to content

Commit

Permalink
Update Player.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Grenagar committed Jun 21, 2024
1 parent 6c3de65 commit af1bb14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/gameClasses/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ var Player = TaroEntity.extend({
self.streamUpdateData(playerJoinStreamData);
}
}

if (self._stats.userId || self._stats.guestUserId) {
taro.workerComponent && taro.workerComponent.playerJoined(clientId, self._stats.userId, self._stats.guestUserId);
taro.workerComponent &&
taro.workerComponent.playerJoined(clientId, self._stats.userId, self._stats.guestUserId);
}
} else {
console.log(`player joined again (menu closed?) ${self._stats.clientId} (${self._stats.name})`);
Expand All @@ -163,7 +164,7 @@ var Player = TaroEntity.extend({
var data = Object.assign(data, {
clientId: self._stats.clientId,
name: self._stats.name,
playerId: self.id()
playerId: self.id(),
});

var unit = new Unit(data);
Expand Down Expand Up @@ -723,6 +724,8 @@ var Player = TaroEntity.extend({
window.joinGameSent.end = Date.now();
window.joinGameSent.completed = window.joinGameSent.end - window.joinGameSent.start;

taro.script.trigger('playerJoinsGame', { playerId: self.id() });

console.log(
`JoinGame took ${window.joinGameSent.completed}ms to join player` +
`, client to gs: ${self._stats.receivedJoinGame - window.joinGameSent.start}ms` +
Expand Down

0 comments on commit af1bb14

Please sign in to comment.