feat(nds): add audio in all menus
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user