浏览代码

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

Kirk Trombley 5 年之前
父节点
当前提交
b287764efb
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      client/src/domain/gameStore.js

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

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