1- import React , { useCallback , useRef , useState } from 'react' ;
1+ import React , { useCallback , useRef , useState , useEffect } from 'react' ;
22import { motion } from 'framer-motion' ;
33import { useGameStore } from '@/store/gameStore' ;
44import { audioAnalyzer } from '@/core/AudioAnalyzer' ;
5+ import { soundManager } from '@/core/SoundManager' ;
56import { Music , Upload , Play , Drum } from 'lucide-react' ;
67import { Button } from '@/components/ui/button' ;
78import type { Difficulty } from '@/types/game' ;
@@ -16,7 +17,29 @@ export function MenuScreen({ onStartDemo, onStartWithAudio }: MenuScreenProps) {
1617 const [ selectedDifficulty , setSelectedDifficulty ] = useState < Difficulty > ( 'normal' ) ;
1718 const [ isLoading , setIsLoading ] = useState ( false ) ;
1819
19- const { setAudioFile, setCurrentBeatMap, audioFile } = useGameStore ( ) ;
20+ const { setAudioFile, setCurrentBeatMap, audioFile, leftHand, rightHand } = useGameStore ( ) ;
21+
22+ const isDon = ! leftHand && rightHand ;
23+ const isKat = leftHand && ! rightHand ;
24+ const isBoom = leftHand && rightHand ;
25+ const isAir = ! leftHand && ! rightHand ;
26+
27+ // Sound effects for tutorial
28+ useEffect ( ( ) => {
29+ if ( isDon ) soundManager . playDon ( ) ;
30+ } , [ isDon ] ) ;
31+
32+ useEffect ( ( ) => {
33+ if ( isKat ) soundManager . playKat ( ) ;
34+ } , [ isKat ] ) ;
35+
36+ useEffect ( ( ) => {
37+ if ( isBoom ) soundManager . playBoom ( ) ;
38+ } , [ isBoom ] ) ;
39+
40+ useEffect ( ( ) => {
41+ if ( isAir ) soundManager . playAir ( ) ;
42+ } , [ isAir ] ) ;
2043
2144 const handleFileSelect = useCallback ( async ( e : React . ChangeEvent < HTMLInputElement > ) => {
2245 const file = e . target . files ?. [ 0 ] ;
@@ -169,38 +192,58 @@ export function MenuScreen({ onStartDemo, onStartWithAudio }: MenuScreenProps) {
169192 >
170193 < div className = "text-muted-foreground text-sm mb-6" > 游戏玩法说明</ div >
171194 < div className = "grid grid-cols-2 md:grid-cols-4 gap-4" >
172- < div className = "bg-card/50 rounded-xl p-4 border border-border" >
173- < div className = "w-12 h-12 mx-auto mb-2 rounded-full drum-don flex items-center justify-center" >
195+ < div
196+ className = { `
197+ bg-card/50 rounded-xl p-4 border transition-all duration-200
198+ ${ isDon ? 'border-red-500 bg-red-500/10 scale-105 shadow-lg shadow-red-500/20 ring-2 ring-red-500/50' : 'border-border' }
199+ ` }
200+ >
201+ < div className = { `w-12 h-12 mx-auto mb-2 rounded-full drum-don flex items-center justify-center transition-transform ${ isDon ? 'scale-110' : '' } ` } >
174202 < span className = "text-white font-bold" > 咚</ span >
175203 </ div >
176- < div className = "text-foreground font-medium mb-1 text-sm" > 红鼓 (Don)</ div >
204+ < div className = { ` font-medium mb-1 text-sm transition-colors ${ isDon ? 'text-red-500 font-bold' : 'text-foreground' } ` } > 红鼓 (Don)</ div >
177205 < div className = "text-muted-foreground text-[10px] leading-tight" >
178206 屏幕中只有右手
179207 </ div >
180208 </ div >
181- < div className = "bg-card/50 rounded-xl p-4 border border-border" >
182- < div className = "w-12 h-12 mx-auto mb-2 rounded-full drum-kat flex items-center justify-center" >
209+ < div
210+ className = { `
211+ bg-card/50 rounded-xl p-4 border transition-all duration-200
212+ ${ isKat ? 'border-blue-500 bg-blue-500/10 scale-105 shadow-lg shadow-blue-500/20 ring-2 ring-blue-500/50' : 'border-border' }
213+ ` }
214+ >
215+ < div className = { `w-12 h-12 mx-auto mb-2 rounded-full drum-kat flex items-center justify-center transition-transform ${ isKat ? 'scale-110' : '' } ` } >
183216 < span className = "text-white font-bold" > 咔</ span >
184217 </ div >
185- < div className = "text-foreground font-medium mb-1 text-sm" > 蓝鼓 (Kat)</ div >
218+ < div className = { ` font-medium mb-1 text-sm transition-colors ${ isKat ? 'text-blue-500 font-bold' : 'text-foreground' } ` } > 蓝鼓 (Kat)</ div >
186219 < div className = "text-muted-foreground text-[10px] leading-tight" >
187220 屏幕中只有左手
188221 </ div >
189222 </ div >
190- < div className = "bg-card/50 rounded-xl p-4 border border-border" >
191- < div className = "w-12 h-12 mx-auto mb-2 rounded-full drum-boom flex items-center justify-center" >
223+ < div
224+ className = { `
225+ bg-card/50 rounded-xl p-4 border transition-all duration-200
226+ ${ isBoom ? 'border-zinc-500 bg-zinc-500/10 scale-105 shadow-lg shadow-zinc-500/20 ring-2 ring-zinc-500/50' : 'border-border' }
227+ ` }
228+ >
229+ < div className = { `w-12 h-12 mx-auto mb-2 rounded-full drum-boom flex items-center justify-center transition-transform ${ isBoom ? 'scale-110' : '' } ` } >
192230 < span className = "text-white font-bold text-xs" > BOOM</ span >
193231 </ div >
194- < div className = "text-foreground font-medium mb-1 text-sm" > 黑鼓 (Boom)</ div >
232+ < div className = { ` font-medium mb-1 text-sm transition-colors ${ isBoom ? 'text-zinc-500 font-bold' : 'text-foreground' } ` } > 黑鼓 (Boom)</ div >
195233 < div className = "text-muted-foreground text-[10px] leading-tight" >
196234 屏幕中有双手
197235 </ div >
198236 </ div >
199- < div className = "bg-card/50 rounded-xl p-4 border border-border" >
200- < div className = "w-12 h-12 mx-auto mb-2 rounded-full drum-air flex items-center justify-center" >
237+ < div
238+ className = { `
239+ bg-card/50 rounded-xl p-4 border transition-all duration-200
240+ ${ isAir ? 'border-zinc-300 bg-zinc-100/10 scale-105 shadow-lg shadow-zinc-300/20 ring-2 ring-zinc-300/50' : 'border-border' }
241+ ` }
242+ >
243+ < div className = { `w-12 h-12 mx-auto mb-2 rounded-full drum-air flex items-center justify-center transition-transform ${ isAir ? 'scale-110' : '' } ` } >
201244 < span className = "text-black font-bold text-xs" > AIR</ span >
202245 </ div >
203- < div className = "text-foreground font-medium mb-1 text-sm" > 白鼓 (Air)</ div >
246+ < div className = { ` font-medium mb-1 text-sm transition-colors ${ isAir ? 'text-zinc-300 font-bold' : 'text-foreground' } ` } > 白鼓 (Air)</ div >
204247 < div className = "text-muted-foreground text-[10px] leading-tight" >
205248 屏幕中没有手
206249 </ div >
0 commit comments