Add mission_brief_shown event to hint system
- Add 'mission_brief_shown' event type to HintEntry interface - Add triggerMissionBriefShown() method to LevelHintSystem - Call hint trigger when mission brief is displayed in Level1 - Remove old missionBriefAudio playback from MissionBrief class This enables database-configurable audio hints (like welcome_rookie) to play when the mission brief is shown. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3104859bb7
commit
64331b4566
@ -146,6 +146,16 @@ export class LevelHintSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger mission brief shown hints - call when mission brief is displayed
|
||||||
|
*/
|
||||||
|
public triggerMissionBriefShown(): void {
|
||||||
|
const hints = this._hints.filter(h => h.eventType === 'mission_brief_shown');
|
||||||
|
for (const hint of hints) {
|
||||||
|
this.queueHint(hint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue a hint for audio playback
|
* Queue a hint for audio playback
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -239,6 +239,9 @@ export class Level1 implements Level {
|
|||||||
inputManager.enableShipControls("MissionBrief");
|
inputManager.enableShipControls("MissionBrief");
|
||||||
this.startGameplay();
|
this.startGameplay();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Trigger mission brief hints (e.g., welcome_rookie audio)
|
||||||
|
this._hintSystem?.triggerMissionBriefShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import log from '../core/logger';
|
|||||||
export interface HintEntry {
|
export interface HintEntry {
|
||||||
id: string;
|
id: string;
|
||||||
levelId: string;
|
levelId: string;
|
||||||
eventType: 'ship_status' | 'asteroid_destroyed' | 'collision';
|
eventType: 'ship_status' | 'asteroid_destroyed' | 'collision' | 'mission_brief_shown';
|
||||||
eventConfig: Record<string, unknown>;
|
eventConfig: Record<string, unknown>;
|
||||||
audioUrl: string;
|
audioUrl: string;
|
||||||
playMode: 'once' | 'always';
|
playMode: 'once' | 'always';
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
} from "@babylonjs/gui";
|
} from "@babylonjs/gui";
|
||||||
import { DefaultScene } from "../../core/defaultScene";
|
import { DefaultScene } from "../../core/defaultScene";
|
||||||
import {MeshBuilder, Vector3, Observable, Observer} from "@babylonjs/core";
|
import {MeshBuilder, Vector3, Observable, Observer} from "@babylonjs/core";
|
||||||
import type { AudioEngineV2, StaticSound } from "@babylonjs/core";
|
import type { AudioEngineV2 } from "@babylonjs/core";
|
||||||
import log from '../../core/logger';
|
import log from '../../core/logger';
|
||||||
import { LevelConfig } from "../../levels/config/levelConfig";
|
import { LevelConfig } from "../../levels/config/levelConfig";
|
||||||
import { CloudLevelEntry } from "../../services/cloudLevelService";
|
import { CloudLevelEntry } from "../../services/cloudLevelService";
|
||||||
@ -24,7 +24,6 @@ export class MissionBrief {
|
|||||||
private _onStartCallback: (() => void) | null = null;
|
private _onStartCallback: (() => void) | null = null;
|
||||||
private _triggerObserver: Observer<void> | null = null;
|
private _triggerObserver: Observer<void> | null = null;
|
||||||
private _audioEngine: AudioEngineV2 | null = null;
|
private _audioEngine: AudioEngineV2 | null = null;
|
||||||
private _currentSound: StaticSound | null = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the mission brief as a fullscreen overlay
|
* Initialize the mission brief as a fullscreen overlay
|
||||||
@ -236,21 +235,6 @@ export class MissionBrief {
|
|||||||
this._container.isVisible = true;
|
this._container.isVisible = true;
|
||||||
this._isVisible = true;
|
this._isVisible = true;
|
||||||
|
|
||||||
// Play mission brief audio if specified
|
|
||||||
if (directoryEntry?.missionBriefAudio && this._audioEngine) {
|
|
||||||
log.info('[MissionBrief] Playing audio:', directoryEntry.missionBriefAudio);
|
|
||||||
this._audioEngine.createSoundAsync(
|
|
||||||
"missionBriefAudio",
|
|
||||||
directoryEntry.missionBriefAudio,
|
|
||||||
{ loop: false, volume: 1.0 }
|
|
||||||
).then(sound => {
|
|
||||||
this._currentSound = sound;
|
|
||||||
sound.play();
|
|
||||||
}).catch(err => {
|
|
||||||
log.error('[MissionBrief] Failed to load audio:', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info('[MissionBrief] ========== CONTAINER NOW VISIBLE ==========');
|
log.info('[MissionBrief] ========== CONTAINER NOW VISIBLE ==========');
|
||||||
log.info('[MissionBrief] Container.isVisible:', this._container.isVisible);
|
log.info('[MissionBrief] Container.isVisible:', this._container.isVisible);
|
||||||
log.info('[MissionBrief] _isVisible flag:', this._isVisible);
|
log.info('[MissionBrief] _isVisible flag:', this._isVisible);
|
||||||
@ -317,10 +301,6 @@ export class MissionBrief {
|
|||||||
* Clean up resources
|
* Clean up resources
|
||||||
*/
|
*/
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
if (this._currentSound) {
|
|
||||||
this._currentSound.dispose();
|
|
||||||
this._currentSound = null;
|
|
||||||
}
|
|
||||||
if (this._advancedTexture) {
|
if (this._advancedTexture) {
|
||||||
this._advancedTexture.dispose();
|
this._advancedTexture.dispose();
|
||||||
this._advancedTexture = null;
|
this._advancedTexture = null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user