Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import type { Tile } from '@/components/GameCanvas/GameCanvas.types'; import { useGameStore } from '@/stores/useGameStore'; interface HandleMismatchPairOptions { playFail: () => Promise<void>; drawBoard: () => void; onMismatch?: (a: Tile, b: Tile) => void; unlock: () => void; } export async function handleMismatchPair(a: Tile, b: Tile, opts: HandleMismatchPairOptions) { await opts.playFail(); if (opts.onMismatch) opts.onMismatch(a, b); await new Promise((resolve) => setTimeout(resolve, 1000)); a.flipped = false; b.flipped = false; opts.drawBoard(); opts.unlock(); useGameStore().incrementMismatch(a, b); } |