Feat/env-manager #1
@@ -8,6 +8,7 @@ import {
|
|||||||
REPAIR_GAME_ZONE_RADIUS,
|
REPAIR_GAME_ZONE_RADIUS,
|
||||||
} from "@/data/gameplay/repairGameConfig";
|
} from "@/data/gameplay/repairGameConfig";
|
||||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||||
|
import { playGameplayDialogueById } from "@/utils/dialogues/playDialogue";
|
||||||
|
|
||||||
const CASE_CLOSED_STEPS = new Set(["locked", "waiting"]);
|
const CASE_CLOSED_STEPS = new Set(["locked", "waiting"]);
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ export function RepairGameZone(): React.JSX.Element {
|
|||||||
|
|
||||||
if (CASE_CLOSED_STEPS.has(bikeStep)) {
|
if (CASE_CLOSED_STEPS.has(bikeStep)) {
|
||||||
setBikeState({ currentStep: "inspected" });
|
setBikeState({ currentStep: "inspected" });
|
||||||
|
void playGameplayDialogueById("narrateur_ebikecasse");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ export function RepairGameZone(): React.JSX.Element {
|
|||||||
|
|
||||||
if (bikeStep === "fragmented") {
|
if (bikeStep === "fragmented") {
|
||||||
setBikeState({ currentStep: "scanning" });
|
setBikeState({ currentStep: "scanning" });
|
||||||
|
void playGameplayDialogueById("narrateur_galetscan");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ import { AudioManager } from "@/managers/AudioManager";
|
|||||||
import { useSettingsStore } from "@/managers/stores/useSettingsStore";
|
import { useSettingsStore } from "@/managers/stores/useSettingsStore";
|
||||||
import { useSubtitleStore } from "@/managers/stores/useSubtitleStore";
|
import { useSubtitleStore } from "@/managers/stores/useSubtitleStore";
|
||||||
import type { DialogueManifest } from "@/types/dialogues/dialogues";
|
import type { DialogueManifest } from "@/types/dialogues/dialogues";
|
||||||
import { loadDialogueSubtitleCue } from "@/utils/dialogues/loadDialogueManifest";
|
import {
|
||||||
|
loadDialogueManifest,
|
||||||
|
loadDialogueSubtitleCue,
|
||||||
|
} from "@/utils/dialogues/loadDialogueManifest";
|
||||||
|
|
||||||
interface QueuedDialogueRequest {
|
interface QueuedDialogueRequest {
|
||||||
manifest: DialogueManifest;
|
manifest: DialogueManifest;
|
||||||
@@ -12,6 +15,8 @@ interface QueuedDialogueRequest {
|
|||||||
|
|
||||||
const DIALOGUE_PLAY_START_TIMEOUT_MS = 800;
|
const DIALOGUE_PLAY_START_TIMEOUT_MS = 800;
|
||||||
const dialogueQueue: QueuedDialogueRequest[] = [];
|
const dialogueQueue: QueuedDialogueRequest[] = [];
|
||||||
|
let gameplayDialogueManifestPromise: Promise<DialogueManifest | null> | null =
|
||||||
|
null;
|
||||||
let isDialogueQueuePlaying = false;
|
let isDialogueQueuePlaying = false;
|
||||||
|
|
||||||
export function queueDialogueById(
|
export function queueDialogueById(
|
||||||
@@ -30,6 +35,16 @@ export function clearQueuedDialogues(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function playGameplayDialogueById(
|
||||||
|
dialogueId: string,
|
||||||
|
): Promise<HTMLAudioElement | null> {
|
||||||
|
gameplayDialogueManifestPromise ??= loadDialogueManifest();
|
||||||
|
const manifest = await gameplayDialogueManifestPromise;
|
||||||
|
if (!manifest) return null;
|
||||||
|
|
||||||
|
return queueDialogueById(manifest, dialogueId);
|
||||||
|
}
|
||||||
|
|
||||||
export async function playDialogueById(
|
export async function playDialogueById(
|
||||||
manifest: DialogueManifest,
|
manifest: DialogueManifest,
|
||||||
dialogueId: string,
|
dialogueId: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user