Skip to content

Commit 131bff4

Browse files
authored
Merge pull request #68 from Game-as-a-Service/feat/check-queue
feat: 修修bug
2 parents fdbd810 + 75fad7e commit 131bff4

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/components/MainLayout.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,26 @@ onMounted(() => {
167167
})
168168
const bgNumber = ref(Math.floor(Math.random() * 10))
169169
const handleUserConnect = () => {
170-
handleConnect()
171170
if (route.query.gameRoomID) {
172171
router.push({
173172
path: route.path,
174173
query: {
175174
gameRoomID: route.query.gameRoomID,
176175
playerId: playerId.value,
177176
},
177+
}).then(() => {
178+
router.go(0)
178179
})
179-
}
180-
router.push({
181-
path: route.path,
182-
query: {
180+
} else {
181+
router.push({
182+
path: route.path,
183+
query: {
183184
// gameRoomID: gameId.value,
184185
// gameId暫時沒用
185-
playerId: playerId.value,
186-
},
187-
})
186+
playerId: playerId.value,
187+
},
188+
})
189+
}
188190
}
189191
</script>
190192
@@ -271,7 +273,7 @@ const handleUserConnect = () => {
271273
for="countries"
272274
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
273275
>切換角色?</label>
274-
<div class="flex pl-5 pb-5 gap-3">
276+
<div class="flex pl-5 pb-5 gap-3 text-white">
275277
<select
276278
id="countries"
277279
v-model="playerId"
@@ -307,6 +309,8 @@ const handleUserConnect = () => {
307309
切換至當前玩家 (a.k.a.
308310
{{ playerIds[gameStore.gameStatus.current_player] }})
309311
</button>
312+
313+
StateQueue: {{ gameStore.gameStatusQueue.length }}
310314
</div>
311315
</div>
312316
</div>

src/stores/game.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,15 @@ export const useGameStore = defineStore('useGameStore', () => {
155155
processGameStatus()
156156
}, 1500)
157157
} else if (status.event_name === 'dice_rolled') {
158-
console.log('dice_rolled: ', status.dice_result)
159158
setPlayDice(status.dice_result)
160159
setShowDice(true)
161160
updateTmpGameStatus(status)
162161
} else if (status.event_name === 'round_started') {
163162
spellFailed.value = false
163+
setGameStatus(status)
164+
processing.value = false
165+
processGameStatus()
164166
} else if (status.event_name === 'spell_owl') {
165-
console.log('select secret')
166167
if (myTurn.value){
167168
updateTmpGameStatus(status)
168169
updateShowSecretTable(true)

0 commit comments

Comments
 (0)