@@ -7,6 +7,7 @@ import { Strings } from '@/game/managers/Strings'
77import type { LanguageCode } from '@/game/managers/Strings'
88import { createTextButton } from '@/game/utils/uiFactory'
99import { on , off } from '@/game/managers/EventBus'
10+ import { DebugHelper } from '@/utils/debugHelper'
1011
1112export default class MainMenuScene extends Phaser . Scene {
1213 private bgmStatusText ?: Phaser . GameObjects . Text
@@ -31,7 +32,7 @@ export default class MainMenuScene extends Phaser.Scene {
3132 LoadManager . init ( this )
3233
3334 // 声明主菜单要播放的BGM
34- console . log ( '🎵 主菜单声明要播放BGM: bgm_main')
35+ DebugHelper . debugLog ( 'BGM' , ' 主菜单声明要播放BGM: bgm_main')
3536 AudioManager . requestBgm ( 'bgm_main' )
3637
3738 // 开始预加载所有BGM(如果还没有开始)
@@ -318,7 +319,7 @@ export default class MainMenuScene extends Phaser.Scene {
318319 * 开始预加载所有BGM(主菜单BGM + 游戏BGM)
319320 */
320321 private async startAllBGMPreload ( ) {
321- console . log ( '🎵 开始预加载所有BGM...')
322+ DebugHelper . debugLog ( 'BGM' , ' 开始预加载所有BGM...')
322323
323324 try {
324325 // 并行预加载主菜单BGM和游戏BGM
@@ -328,7 +329,7 @@ export default class MainMenuScene extends Phaser.Scene {
328329 ]
329330
330331 await Promise . allSettled ( promises )
331- console . log ( '✅ 所有BGM预加载完成')
332+ DebugHelper . debugLog ( 'BGM' , ' 所有BGM预加载完成')
332333 } catch ( error ) {
333334 console . warn ( '⚠️ BGM预加载过程中出现错误:' , error )
334335 }
@@ -340,11 +341,11 @@ export default class MainMenuScene extends Phaser.Scene {
340341 private checkAndInitializeBGMStatus ( width : number , height : number ) {
341342 // 检查主菜单BGM是否已经加载完成
342343 if ( LoadManager . isAudioLoaded ( 'bgm_main' ) ) {
343- console . log ( '✅ 主菜单BGM已加载,隐藏状态指示器')
344+ DebugHelper . debugLog ( 'BGM' , ' 主菜单BGM已加载,隐藏状态指示器')
344345 // BGM已加载完成,不需要显示状态指示器
345346 // 可以选择隐藏或者显示"已就绪"状态后淡出
346347 } else {
347- console . log ( '⏳ 主菜单BGM尚未加载,显示状态指示器')
348+ DebugHelper . debugLog ( 'BGM' , ' 主菜单BGM尚未加载,显示状态指示器')
348349 // BGM还未加载完成,显示状态指示器
349350 this . createBGMStatusIndicator ( width , height )
350351 this . updateBGMStatus ( 'loading' )
@@ -393,7 +394,7 @@ export default class MainMenuScene extends Phaser.Scene {
393394 private updateBGMStatus ( status : 'loading' | 'ready' | 'failed' ) {
394395 try {
395396 if ( ! this . bgmStatusText || ! this . bgmLoadingIndicator ) {
396- console . log ( 'BGM状态指示器未初始化,跳过状态更新' )
397+ DebugHelper . debugLog ( 'BGM' , 'BGM状态指示器未初始化,跳过状态更新' )
397398 return
398399 }
399400
@@ -419,7 +420,7 @@ export default class MainMenuScene extends Phaser.Scene {
419420 const text = Strings . t ( textKey )
420421 this . bgmStatusText . setText ( text )
421422 this . bgmStatusText . setColor ( color )
422- console . log ( `BGM状态更新: ${ text } ` )
423+ DebugHelper . debugLog ( 'BGM' , `BGM状态更新: ${ text } ` )
423424
424425 // 加载完成或失败后3秒隐藏指示器
425426 if ( status === 'ready' || status === 'failed' ) {
@@ -448,6 +449,6 @@ export default class MainMenuScene extends Phaser.Scene {
448449 shutdown ( ) {
449450 // 重置BGM加载标志,允许重新进入时重新加载
450451 this . bgmLoadStarted = false
451- console . log ( 'MainMenuScene shutdown - BGM加载状态已重置' )
452+ DebugHelper . debugLog ( 'BGM' , 'MainMenuScene shutdown - BGM加载状态已重置' )
452453 }
453454}
0 commit comments