add join link
This commit is contained in:
parent
483dadaa4e
commit
54f0a3efb9
|
|
@ -13,6 +13,7 @@
|
|||
"generate": "Release the fish",
|
||||
"ready": "Ready",
|
||||
"cancel": "Cancel",
|
||||
"copyLink": "Copy join link",
|
||||
"mainScreen": "Go to main screen",
|
||||
"instruction": "How to play",
|
||||
"rules": "Game rules"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"generate": "Запустить рыбу",
|
||||
"ready": "Готов",
|
||||
"cancel": "Отмена",
|
||||
"copyLink": "Копировать ссылку для подключения",
|
||||
"mainScreen": "На главный экран",
|
||||
"instruction": "Как играть",
|
||||
"rules": "Правила"
|
||||
|
|
|
|||
|
|
@ -124,7 +124,11 @@ export const useGameStore = defineStore("game", {
|
|||
ready() {
|
||||
const board = new boardConstructor(this.boardSize, this.getAvailableItems())
|
||||
if (!board.isAllItemsReady(this.player.items)) return
|
||||
this.player.status = "ready"
|
||||
if (this.player.status == "ready") {
|
||||
this.player.status = "lobby"
|
||||
} else {
|
||||
this.player.status = "ready"
|
||||
}
|
||||
if (this.mode == "single") {
|
||||
useBotStore().generate()
|
||||
return
|
||||
|
|
|
|||
|
|
@ -27,9 +27,16 @@ const generate = () => {
|
|||
//Set ready status for player
|
||||
const ready = () => {
|
||||
if (game.mode == 'single') useBotStore().generate()
|
||||
if (game.player.status == 'ready') game.player.status = 'lobby'
|
||||
if (board.isAllItemsReady(game.player.items)) game.ready()
|
||||
}
|
||||
|
||||
const copyJoinLink = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(window.location.origin + '/join/' + game.id);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
}
|
||||
}
|
||||
const drawCell = (row, col) => {
|
||||
let classes = ''
|
||||
let cell = ((row * game.boardSize) + col) - 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user