Voiceovers, Hints
This commit is contained in:
1 parent
83888a21e1
commit
43e02d5e08
63 files changed
+103
-23
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
// TODO: this shit
|
||||||
@@ -23,6 +23,8 @@ export interface RiddleScreenControls {
|
|||||||
page: number;
|
page: number;
|
||||||
setPage: (pageIndex: number) => void;
|
setPage: (pageIndex: number) => void;
|
||||||
voiceOverMode: VoiceOverMode;
|
voiceOverMode: VoiceOverMode;
|
||||||
|
requestingHint: boolean;
|
||||||
|
dismissHint: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface RiddleScreenProps {
|
interface RiddleScreenProps {
|
||||||
@@ -32,6 +34,7 @@ interface RiddleScreenProps {
|
|||||||
|
|
||||||
export default function RiddleScreen({ riddle, onDismiss }: RiddleScreenProps) {
|
export default function RiddleScreen({ riddle, onDismiss }: RiddleScreenProps) {
|
||||||
const [page, setPage ] = useState(0);
|
const [page, setPage ] = useState(0);
|
||||||
|
const [ showHintPage, setShowHintPage ] = useState(false);
|
||||||
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voiceover, "off");
|
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voiceover, "off");
|
||||||
const [ showBanner, setShowBanner ] = useState(true);
|
const [ showBanner, setShowBanner ] = useState(true);
|
||||||
const contentRef = useRef<HTMLDivElement | null>(null);
|
const contentRef = useRef<HTMLDivElement | null>(null);
|
||||||
@@ -55,6 +58,10 @@ export default function RiddleScreen({ riddle, onDismiss }: RiddleScreenProps) {
|
|||||||
"showBanner": setShowBanner,
|
"showBanner": setShowBanner,
|
||||||
"exitFunction": exitFunction,
|
"exitFunction": exitFunction,
|
||||||
"voiceOverMode": voiceOverState as VoiceOverMode,
|
"voiceOverMode": voiceOverState as VoiceOverMode,
|
||||||
|
"requestingHint": showHintPage,
|
||||||
|
"dismissHint": () => {
|
||||||
|
setShowHintPage(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const riddleComponents: Record<string, ComponentType<RiddleScreenControls>> = {
|
const riddleComponents: Record<string, ComponentType<RiddleScreenControls>> = {
|
||||||
@@ -84,12 +91,12 @@ export default function RiddleScreen({ riddle, onDismiss }: RiddleScreenProps) {
|
|||||||
}} alt="Background" loading="eager"/>
|
}} alt="Background" loading="eager"/>
|
||||||
<StyledContainer riddleDesign={true}>
|
<StyledContainer riddleDesign={true}>
|
||||||
<div className={styles["actions-bookmark"]}>
|
<div className={styles["actions-bookmark"]}>
|
||||||
<img src={"/icons/hinweis.svg"} className={styles["bookmark-icon"]} style={{width: "20px", height: "auto", margin: "12px 24px", marginTop: "12px"}} onClick={() => alert("Error: Hinweis-Daten nicht geladen")} />
|
<img src={"/icons/hinweis.svg"} className={styles["bookmark-icon"]} style={{width: "20px", height: "auto", margin: "12px 24px", marginTop: "12px"}} onClick={() => setShowHintPage(true)} />
|
||||||
<img src={voiceOverState === "off" ? "/icons/Vorlese-Icon.svg" : "/icons/Vorlese-Icon-leise.svg"} className={styles["bookmark-icon"]} style={{width: "28px", height: "24px", margin: "0px 20px 24px"}} onClick={() => {
|
<img src={voiceOverState === "off" ? "/icons/Vorlese-Icon.svg" : "/icons/Vorlese-Icon-leise.svg"} className={styles["bookmark-icon"]} style={{width: "28px", height: "24px", margin: "0px 20px 24px"}} onClick={() => {
|
||||||
setVoiceOverState(voiceOverState === "off" ? "on" : "off");
|
setVoiceOverState(voiceOverState === "off" ? "on" : "off");
|
||||||
}} />
|
}} />
|
||||||
</div>
|
</div>
|
||||||
<img src="/icons/kreuz.svg" className={styles["close"]} onClick={onDismiss}/>
|
<img src="/icons/kreuz.svg" className={styles["close"]} onClick={exitFunction}/>
|
||||||
<div className={styles["content-container"]} ref={contentRef}>
|
<div className={styles["content-container"]} ref={contentRef}>
|
||||||
{ showBanner ? <div className={styles["title"]}>
|
{ showBanner ? <div className={styles["title"]}>
|
||||||
<p className="eisenkraft-regular" style={{fontSize: "1.25rem", color: "var(--blue)"}}>{riddle["station_name"]}</p>
|
<p className="eisenkraft-regular" style={{fontSize: "1.25rem", color: "var(--blue)"}}>{riddle["station_name"]}</p>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { VoiceOverMode } from "@/types/voiceOverMode";
|
||||||
|
import { useEffect, useRef } from "react";
|
||||||
|
|
||||||
|
export type VoiceOverSource = {
|
||||||
|
src: string;
|
||||||
|
type: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface VoiceOverProps {
|
||||||
|
sources: VoiceOverSource[];
|
||||||
|
voiceOverMode: VoiceOverMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function VoiceOver({ sources, voiceOverMode }: VoiceOverProps) {
|
||||||
|
const audioRef = useRef<HTMLAudioElement | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const audio = audioRef.current;
|
||||||
|
if (!audio) return;
|
||||||
|
|
||||||
|
if (voiceOverMode === "on") {
|
||||||
|
audio.play().catch((error) => {
|
||||||
|
console.warn("Audio playback prevented:", error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
audio.pause();
|
||||||
|
audio.currentTime = 0;
|
||||||
|
}
|
||||||
|
}, [voiceOverMode]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<audio
|
||||||
|
ref={audioRef}
|
||||||
|
controlsList="nodownload nofullscreen"
|
||||||
|
preload="auto"
|
||||||
|
playsInline={true}
|
||||||
|
>
|
||||||
|
{sources.map((source, index) => (
|
||||||
|
<source key={source.src || index} src={source.src} type={source.type} />
|
||||||
|
))}
|
||||||
|
</audio>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import { addPoints } from "@/utils/points";
|
|||||||
import RiddleCompleteBanner from "../RiddleCompleteBanner";
|
import RiddleCompleteBanner from "../RiddleCompleteBanner";
|
||||||
import { setPlayers } from "@/utils/players";
|
import { setPlayers } from "@/utils/players";
|
||||||
import { setPlayerAnswers } from "@/utils/player_answers";
|
import { setPlayerAnswers } from "@/utils/player_answers";
|
||||||
|
import VoiceOver from "../VoiceOver";
|
||||||
|
|
||||||
export default function Riddle_1({
|
export default function Riddle_1({
|
||||||
page,
|
page,
|
||||||
@@ -21,7 +22,9 @@ export default function Riddle_1({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [ playerCountStr, setPlayerCount ] = useLocalStorage(PREF.playerCount, "");
|
const [ playerCountStr, setPlayerCount ] = useLocalStorage(PREF.playerCount, "");
|
||||||
const playerCount = Number.parseInt(playerCountStr) || 0;
|
const playerCount = Number.parseInt(playerCountStr) || 0;
|
||||||
@@ -67,6 +70,12 @@ export default function Riddle_1({
|
|||||||
const pages = [
|
const pages = [
|
||||||
(
|
(
|
||||||
<div key={0}>
|
<div key={0}>
|
||||||
|
<VoiceOver voiceOverMode={voiceOverMode} sources={[
|
||||||
|
{
|
||||||
|
"src": "/res/tour/riddle_1/voiceovers/Geschichte.mp3",
|
||||||
|
"type": "audio/mpeg"
|
||||||
|
}
|
||||||
|
]}/>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<p>An den ersten Toren des Burggeländes erwartet euch ein Gelehrter. Schon von Weitem konntet ihr beobachten, wie er jeden Reisenden anhält, einige Fragen stellt und anschließend sorgfältig etwas in ein großes Buch einträgt.</p>
|
<p>An den ersten Toren des Burggeländes erwartet euch ein Gelehrter. Schon von Weitem konntet ihr beobachten, wie er jeden Reisenden anhält, einige Fragen stellt und anschließend sorgfältig etwas in ein großes Buch einträgt.</p>
|
||||||
<p>Als ihr näher kommt, mustert er euch aufmerksam, taucht seine Feder in die Tinte und begrüßt euch mit einem wissenden Lächeln: „Seid gegrüßt, Fremde. Dem Ruf von Excalibur gefolgt, nehme ich an? Ja, das dachte ich mir.“</p>
|
<p>Als ihr näher kommt, mustert er euch aufmerksam, taucht seine Feder in die Tinte und begrüßt euch mit einem wissenden Lächeln: „Seid gegrüßt, Fremde. Dem Ruf von Excalibur gefolgt, nehme ich an? Ja, das dachte ich mir.“</p>
|
||||||
@@ -83,6 +92,12 @@ export default function Riddle_1({
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
<div key={1}>
|
<div key={1}>
|
||||||
|
<VoiceOver voiceOverMode={voiceOverMode} sources={[
|
||||||
|
{
|
||||||
|
"src": "/res/tour/riddle_1/voiceovers/Aufgabe.mp3",
|
||||||
|
"type": "audio/mpeg"
|
||||||
|
}
|
||||||
|
]}/>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<p style={{fontWeight: "bold", textAlign: "center", fontSize: "1rem"}}>Was schuldet ein Herr seinem Gesinde am allermeisten?</p>
|
<p style={{fontWeight: "bold", textAlign: "center", fontSize: "1rem"}}>Was schuldet ein Herr seinem Gesinde am allermeisten?</p>
|
||||||
<p style={{fontWeight: "bold", textAlign: "center", fontSize: "1.1rem"}}>{counterStrings[nameScreen]}</p>
|
<p style={{fontWeight: "bold", textAlign: "center", fontSize: "1.1rem"}}>{counterStrings[nameScreen]}</p>
|
||||||
@@ -182,6 +197,12 @@ export default function Riddle_1({
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
<div key={2}>
|
<div key={2}>
|
||||||
|
<VoiceOver voiceOverMode={voiceOverMode} sources={[
|
||||||
|
{
|
||||||
|
"src": "/res/tour/riddle_1/voiceovers/Erfolg.mp3",
|
||||||
|
"type": "audio/mpeg"
|
||||||
|
}
|
||||||
|
]}/>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<RiddleCompleteBanner points={testPoints} win={true}></RiddleCompleteBanner>
|
<RiddleCompleteBanner points={testPoints} win={true}></RiddleCompleteBanner>
|
||||||
<p>Der Gelehrte betrachtet seine Einträge noch einmal und nickt zufrieden.</p>
|
<p>Der Gelehrte betrachtet seine Einträge noch einmal und nickt zufrieden.</p>
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export default function Riddle_2({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ export default function Riddle_3({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [buttonDebounce, setButtonDebounce] = useState(false);
|
const [buttonDebounce, setButtonDebounce] = useState(false);
|
||||||
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ export default function Riddle_4({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [ selection, setSelection ] = useState(-1);
|
const [ selection, setSelection ] = useState(-1);
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ export default function Riddle_4({
|
|||||||
<p>Irgendetwas daran stimmt nicht.</p>
|
<p>Irgendetwas daran stimmt nicht.</p>
|
||||||
<p>Wenn ihr glaubt, die Unterhaltung verstanden zu haben, drückt ihr auf "Weiter".</p>
|
<p>Wenn ihr glaubt, die Unterhaltung verstanden zu haben, drückt ihr auf "Weiter".</p>
|
||||||
<div style={{display: "flex", justifyContent: "center", flexDirection: "column", rowGap: "1rem"}}>
|
<div style={{display: "flex", justifyContent: "center", flexDirection: "column", rowGap: "1rem"}}>
|
||||||
<audio controls controlsList="nodownload nofullscreen" preload="auto" style={{width: "100%"}}>
|
<audio controls controlsList="nodownload nofullscreen" preload="auto" style={{width: "100%"}} playsInline={true}>
|
||||||
<source src="/res/tour/riddle_4/audio.mp3" type="audio/mpeg" />
|
<source src="/res/tour/riddle_4/audio.mp3" type="audio/mpeg" />
|
||||||
</audio>
|
</audio>
|
||||||
<OldButton red={false} onAction={() => {
|
<OldButton red={false} onAction={() => {
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ export default function Riddle_5({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [ solution, setSolution ] = useState("");
|
const [ solution, setSolution ] = useState("");
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ export default function Riddle_6({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [aclTest, setAclTest ] = useState("X: -\nY: -\nZ: -\nO: -");
|
const [aclTest, setAclTest ] = useState("X: -\nY: -\nZ: -\nO: -");
|
||||||
const [ overallChange, setOverallChange ] = useState(0);
|
const [ overallChange, setOverallChange ] = useState(0);
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export default function Riddle_7({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
|
|
||||||
const pages = [
|
const pages = [
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export default function Riddle_8({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
|
|
||||||
const pages = [
|
const pages = [
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ export default function Riddle_9({
|
|||||||
riddle,
|
riddle,
|
||||||
showBanner,
|
showBanner,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
voiceOverMode
|
voiceOverMode,
|
||||||
|
requestingHint,
|
||||||
|
dismissHint,
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
|
||||||
|
|
||||||
const [ playerIndex, setPlayerIndex ] = useState(0);
|
|
||||||
const players = useMemo(() => getPlayers(), [playersStr]);
|
|
||||||
|
|
||||||
const pages = [
|
const pages = [
|
||||||
(
|
(
|
||||||
@@ -39,17 +37,13 @@ export default function Riddle_9({
|
|||||||
(
|
(
|
||||||
<div key={1}>
|
<div key={1}>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<p>Zieh mal {players[playerIndex].name}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["buttons"]}>
|
<div className={styles["buttons"]}>
|
||||||
<OldButton red={false} onAction={() => {
|
<OldButton red={false} onAction={() => {
|
||||||
if (playerIndex >= players.length-1) {
|
setPage(2);
|
||||||
setPage(2);
|
|
||||||
} else {
|
|
||||||
setPlayerIndex(playerIndex+1);
|
|
||||||
}
|
|
||||||
}} disabled={false}>WEITER</OldButton>
|
}} disabled={false}>WEITER</OldButton>
|
||||||
{playerIndex < 1 ? <OldButton red={true} onAction={() => setPage(0)}>ZURÜCK</OldButton> : null}
|
<OldButton red={true} onAction={() => setPage(0)}>ZURÜCK</OldButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user