feat(nds): add audio in all menus

This commit is contained in:
2026-02-25 14:52:48 +01:00
parent 4af6de5329
commit 858082e151
45 changed files with 240 additions and 117 deletions

View File

@@ -5,6 +5,7 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
initialButton,
canClickButton,
onActivate,
onNavigate,
navigation,
disabled,
selectorAnimation,
@@ -13,6 +14,7 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
initialButton: keyof T;
canClickButton?: (buttonName: keyof T) => boolean;
onActivate?: (buttonName: keyof T) => void;
onNavigate?: (buttonName: keyof T) => void;
navigation: Record<
keyof T,
{
@@ -231,6 +233,12 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
if (selectedButton.value === buttonName) {
onActivate?.(buttonName);
} else {
if (onNavigate) {
onNavigate(buttonName);
} else {
const { assets } = useAssets();
assets.audio.tinyClick.play(0.8);
}
const path = findPath(graph, selectedButton.value, buttonName);
if (
@@ -356,6 +364,12 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
}
if (targetButton) {
if (onNavigate) {
onNavigate(targetButton);
} else {
const { assets } = useAssets();
assets.audio.tinyClick.play(0.8);
}
const path = findPath(graph, selectedButton.value, targetButton);
animateToButton(targetButton, path);
}