fix(game): 修复输了能进下一关的Bug、换关后塔残留、召唤按钮太小、战斗前不能发激励

This commit is contained in:
Cloud Bot
2026-03-24 08:30:03 +00:00
parent d7253c45be
commit 653c54c06f
4 changed files with 53 additions and 23 deletions

View File

@@ -365,8 +365,11 @@ export function createGameScene(PhaserLib: typeof Phaser): typeof Phaser.Scene {
this.waveManager.startNextWave()
const waveNum = this.waveManager.getCurrentWaveNumber()
this.hud.showWaveBanner(waveNum, this.waveManager.totalWaves)
// 波次开始音效
AudioEngine.getInstance().playWaveStart()
// 通知 React 层:战斗已开始,允许发起激励
if (typeof window !== 'undefined') {
;(window as any).__gameWaveStarted = true
}
}
private onWeeklyReport(): void {
@@ -375,7 +378,11 @@ export function createGameScene(PhaserLib: typeof Phaser): typeof Phaser.Scene {
}
private onMapCleared(): void {
// 若游戏已失败,不触发地图切换
if (this.manager.gameState === 'defeat') return
this.mapInTransition = true
this.autoNextWaveTimer = -1
this.isWaveRunning = false
this.hud.disableWaveButton()
this.hud.setWaveButtonText('关卡完成!')
@@ -390,6 +397,8 @@ export function createGameScene(PhaserLib: typeof Phaser): typeof Phaser.Scene {
this.manager.totalWaveCleared += currentMap.waveCount
this.manager.currentMapIndex = nextIndex
this.waveManager.clearAllEnemies()
// 清除上一关所有防御塔
this.towerManager.clearAllTowers()
this.loadMap(ALL_MAPS[nextIndex])
this.hud.enableWaveButton()
this.hud.setWaveButtonText('▶ 召唤下一波')