fix join process
This commit is contained in:
parent
16a688212e
commit
9236620b4c
|
|
@ -14,6 +14,7 @@
|
|||
"ready": "Ready",
|
||||
"cancel": "Cancel",
|
||||
"copyLink": "Copy join link",
|
||||
"joinGame": "Join game",
|
||||
"mainScreen": "Go to main screen",
|
||||
"instruction": "How to play",
|
||||
"rules": "Game rules"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
"ready": "Готов",
|
||||
"cancel": "Отмена",
|
||||
"copyLink": "Копировать ссылку для подключения",
|
||||
"joinGame": "Присоединится к игре",
|
||||
"mainScreen": "На главный экран",
|
||||
"instruction": "Как играть",
|
||||
"rules": "Правила"
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ export const useWebsocketStore = defineStore("websocket", {
|
|||
break
|
||||
case 'join':
|
||||
console.log('Recieve join from ' + data.from)
|
||||
if (game.owner != player.id) return // Only owner ccan process join
|
||||
if (game.owner == data.from || game.opponent.id == data.from) window.location.href = window.location.origin + '/lobby/' + game.id
|
||||
if (game.owner != player.id) return // Only owner can process join
|
||||
game.join(data.from)
|
||||
break
|
||||
case 'welcome':
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ if (player.id == null) player.initPlayer()
|
|||
websocket.init(route.params.gameId)
|
||||
|
||||
const join = () => {
|
||||
websocket.send({
|
||||
res = websocket.send({
|
||||
action: 'join',
|
||||
from: player.id
|
||||
})
|
||||
|
|
@ -31,7 +31,7 @@ const join = () => {
|
|||
|
||||
<template>
|
||||
<div>
|
||||
<button class="button_game_start" @click="join()">{{ $t("button.startNewGame") }}</button>
|
||||
<button class="button_game_start" @click="join()">{{ $t("button.joinGame") }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user