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