feat(nds): add audio in all menus

This commit is contained in:
2026-02-25 14:52:48 +01:00
parent 61aec3da2e
commit bbe20150ed
45 changed files with 240 additions and 117 deletions

View File

@@ -17,7 +17,7 @@ const handleActivateB = () => {
onClosed: async (choice) => {
if (choice === "A") {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
}
},
keepButtonsDown: (choice) => choice === "A",
@@ -460,6 +460,8 @@ const slide = (rowDir: number, colDir: number) => {
);
if (!changed) return;
assets.audio.type.play(0.35);
if (board.some((r) => r.some((c) => c >= 512))) {
achievements.unlock("2048_score_512");
}
@@ -534,11 +536,20 @@ const slide = (rowDir: number, colDir: number) => {
}
}
if (mergePairs.length > 0) {
const highestMerge = Math.max(...mergePairs.map((p) => p.mergedValue));
const boardMax = Math.max(0, ...beforeTiles.map((t) => t.value));
if (highestMerge > boardMax) {
assets.audio.duplicate.play(0.35);
}
}
const spawned = spawnTile();
saveState();
if (isDead()) {
buildTilesFromBoard();
assets.audio.invalid.play();
showRestartModal();
return;
}

View File

@@ -181,7 +181,7 @@ const handleActivateA = () => {
),
onClosed: async () => {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
},
keepButtonsDown: true,
timeout: 2000,

View File

@@ -120,7 +120,7 @@ const handleActivateA = () => {
: $t("settings.options.renderingMode.confirmation2d"),
onClosed: async () => {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
},
keepButtonsDown: true,
timeout: 2000,