Przeglądaj źródła

Changing gameStore to actually do a full reset on going to a lobby

Kirk Trombley 5 lat temu
rodzic
commit
b287764efb
1 zmienionych plików z 6 dodań i 2 usunięć
  1. 6 2
      client/src/domain/gameStore.js

+ 6 - 2
client/src/domain/gameStore.js

@@ -29,7 +29,12 @@ export const [
   gameState: PRE_GAME,
 }, {
   setPlayerName: ([set], playerName) => set({ playerName }),
-  goToLobby: ([set], gameId) => set({ gameId, gameState: PRE_ROUND }),
+  goToLobby: ([set], gameId) => set({ 
+    gameId, 
+    gameJoined: false,
+    playerId: null,
+    gameState: PRE_ROUND,
+  }),
   joinGame: async ([set, get]) => {
     const gameId = get.gameId();
     const name = get.playerName();
@@ -44,7 +49,6 @@ export const [
       roundNum,
       selectedPoint || { timeout: true }
     );
-    console.log(score + " " + totalScore);
     set({
       lastRound: {
         roundNum,