sound when pieces connect

This commit is contained in:
Zutatensuppe 2021-05-29 23:14:19 +02:00
parent 472113ad74
commit 21d7db5677
14 changed files with 75 additions and 8 deletions

View file

@ -530,7 +530,8 @@ function handleInput(
gameId: string,
playerId: string,
input: Input,
ts: Timestamp
ts: Timestamp,
onSnap?: (playerId: string) => void
): Array<Change> {
const puzzle = GAMES[gameId].puzzle
const evtInfo = getEvtInfo(gameId, playerId)
@ -734,6 +735,9 @@ function handleInput(
changeData(gameId, { finished: ts })
_dataChange()
}
if (onSnap) {
onSnap(playerId)
}
} else {
// Snap to other tiles
const check = (
@ -789,6 +793,9 @@ function handleInput(
changePlayer(gameId, playerId, { d, ts })
_playerChange()
}
if (snapped && onSnap) {
onSnap(playerId)
}
}
} else {
changePlayer(gameId, playerId, { d, ts })