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

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,8 +4,8 @@
<meta charset="UTF-8">
<title>🧩 jigsaw.hyottoko.club</title>
<script type="module" crossorigin src="/assets/index.4d785533.js"></script>
<link rel="modulepreload" href="/assets/vendor.b622ee49.js">
<script type="module" crossorigin src="/assets/index.d7fe3ee6.js"></script>
<link rel="modulepreload" href="/assets/vendor.18cd2d7e.js">
<link rel="stylesheet" href="/assets/index.f7304069.css">
</head>
<body>

View file

@ -344,6 +344,7 @@ const INPUT_EV_PLAYER_COLOR = 7;
const INPUT_EV_PLAYER_NAME = 8;
const INPUT_EV_MOVE = 9;
const INPUT_EV_TOGGLE_PREVIEW = 10;
const INPUT_EV_TOGGLE_SOUNDS = 11;
const CHANGE_DATA = 1;
const CHANGE_TILE = 2;
const CHANGE_PLAYER = 3;
@ -366,6 +367,7 @@ var Protocol = {
INPUT_EV_PLAYER_COLOR,
INPUT_EV_PLAYER_NAME,
INPUT_EV_TOGGLE_PREVIEW,
INPUT_EV_TOGGLE_SOUNDS,
CHANGE_DATA,
CHANGE_TILE,
CHANGE_PLAYER,
@ -871,7 +873,7 @@ const getPuzzleWidth = (gameId) => {
const getPuzzleHeight = (gameId) => {
return GAMES[gameId].puzzle.info.height;
};
function handleInput$1(gameId, playerId, input, ts) {
function handleInput$1(gameId, playerId, input, ts, onSnap) {
const puzzle = GAMES[gameId].puzzle;
const evtInfo = getEvtInfo(gameId, playerId);
const changes = [];
@ -1054,6 +1056,9 @@ function handleInput$1(gameId, playerId, input, ts) {
changeData(gameId, { finished: ts });
_dataChange();
}
if (onSnap) {
onSnap(playerId);
}
}
else {
// Snap to other tiles
@ -1101,6 +1106,9 @@ function handleInput$1(gameId, playerId, input, ts) {
changePlayer(gameId, playerId, { d, ts });
_playerChange();
}
if (snapped && onSnap) {
onSnap(playerId);
}
}
}
else {