Compare commits

..
15 Commits
Author SHA1 Message Date
LionTion 894b02597a Hold Fix 2026-12-02 14:16:15 +01:00
LionTion 7e8a7d7210 Sword Fallbacks 2026-11-03 21:58:05 +01:00
LionTion fea3401415 fullscreen not in dev mode 2026-11-03 21:47:33 +01:00
LionTion 15927216b3 unselectable images in buttons 2026-11-03 19:34:54 +01:00
LionTion d301cf6d9a reachedRiddles 2026-10-26 18:22:57 +01:00
LionTion e6f2448e94 reachedRiddles 2026-10-26 17:46:16 +01:00
LionTion 39c65927ac permission fix 2026-10-26 17:46:04 +01:00
LionTion 17f2eacb4a docker updates 2026-10-24 12:21:21 +02:00
LionTion c809740520 Audio Update 2026-10-24 12:18:47 +02:00
LionTion c08e3bed57 last adjustments 2026-10-24 05:41:08 +02:00
LionTion 4bcce765b7 removed changed code 2026-10-24 04:36:30 +02:00
LionTion 0524875783 few adjustments for prod 2026-10-24 04:34:46 +02:00
LionTion 6b3e3fd8ca fixed fullscreen underscroll 2026-10-24 04:12:11 +02:00
LionTion 15ce86d6f3 few textfield improvements 2026-10-23 22:58:01 +02:00
LionTion 0e65b8c446 small changes 2026-10-23 22:04:35 +02:00
77 changed files with 223 additions and 78 deletions

No files matched your search

+1
View File
@@ -18,4 +18,5 @@ RUN npm run build
FROM nginx:alpine FROM nginx:alpine
COPY --from=builder /app/out /usr/share/nginx/html COPY --from=builder /app/out /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
+1 -1
View File
@@ -18,7 +18,7 @@ module.exports = {
"typescript": { "typescript": {
"ignoreBuildErrors": true, "ignoreBuildErrors": true,
}, },
allowedDevOrigins: ['192.168.0.110', '10.8.0.23'], allowedDevOrigins: ['192.168.0.110', '10.8.0.23', '10.145.37.176'],
}; };
export default withSerwist(nextConfig); export default withSerwist(nextConfig);
+15
View File
@@ -0,0 +1,15 @@
server {
listen 80;
server_name game;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /serwist/ {
add_header Service-Worker-Allowed "/";
}
}
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.
+1
View File
@@ -63,6 +63,7 @@ html,
body { body {
max-width: 100vw; max-width: 100vw;
overflow-x: hidden; overflow-x: hidden;
padding-bottom: env(keyboard-inset-height, 0px);
} }
body { body {
+2 -1
View File
@@ -11,8 +11,9 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: LayoutProps<"/">) { export default function RootLayout({ children }: LayoutProps<"/">) {
return ( return (
<html lang="en" dir="ltr" className={clsx("eisenkraft-regular")}> <html lang="en" dir="ltr" className={clsx("eisenkraft-regular")}>
<meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-visual" />
<meta name="apple-mobile-web-app-title" content="Excalibur Outdoor Tour" /> <meta name="apple-mobile-web-app-title" content="Excalibur Outdoor Tour" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" />
<meta httpEquiv="ScreenOrientation" content="autoRotate:disabled" /> <meta httpEquiv="ScreenOrientation" content="autoRotate:disabled" />
<body> <body>
<SerwistProvider swUrl="/serwist/sw.js">{children}</SerwistProvider> <SerwistProvider swUrl="/serwist/sw.js">{children}</SerwistProvider>
+28 -5
View File
@@ -25,17 +25,40 @@ export default function Main() {
const step = Number.parseInt(stepStr) || 0; const step = Number.parseInt(stepStr) || 0;
useEffect(() => { useEffect(() => {
return;
if (!hasAttachedListerner && step > 0) { if (!hasAttachedListerner && step > 0) {
setHasAttachedListener(true);
const doFullscreen = () => { const doFullscreen = () => {
if (process.env.NODE_ENV === "development") return;
if (screenfull.isEnabled) { if (screenfull.isEnabled) {
screenfull.request(); screenfull.request();
} }
}; };
window.addEventListener("click", () => { window.addEventListener("click", doFullscreen);
doFullscreen(); let cleanup = () => {};
}); if (window.visualViewport) {
setHasAttachedListener(true); const handleResize = () => {
const keyboardHeight = window.innerHeight - window.visualViewport.height;
const appContainer = document.querySelector('#app');
if (appContainer) {
appContainer.style.paddingBottom = keyboardHeight > 0 ? `${keyboardHeight}px` : '0px';
}
if (document.activeElement && keyboardHeight > 0) {
document.activeElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
};
window.visualViewport.addEventListener('resize', handleResize);
window.visualViewport.addEventListener('scroll', handleResize);
cleanup = () => {
if (window.visualViewport) {
window.visualViewport.removeEventListener('resize', handleResize);
window.visualViewport.removeEventListener('scroll', handleResize);
}
};
}
doFullscreen(); doFullscreen();
} }
}, [step, hasAttachedListerner, setHasAttachedListener]); }, [step, hasAttachedListerner, setHasAttachedListener]);
+2
View File
@@ -1,5 +1,7 @@
import { spawnSync } from "node:child_process"; import { spawnSync } from "node:child_process";
import { createSerwistRoute } from "@serwist/turbopack"; import { createSerwistRoute } from "@serwist/turbopack";
import fs from "node:fs";
import path from "node:path";
// If you are using Next.js versions older than 15.0.0, add the // If you are using Next.js versions older than 15.0.0, add the
// `nextConfig` option so that Serwist can configure the service // `nextConfig` option so that Serwist can configure the service
// worker according to your options. Serwist 10 and newer will // worker according to your options. Serwist 10 and newer will
+2 -33
View File
@@ -20,7 +20,7 @@ const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST, precacheEntries: self.__SW_MANIFEST,
precacheOptions: { precacheOptions: {
cleanupOutdatedCaches: true, cleanupOutdatedCaches: true,
concurrency: 20, concurrency: 5,
directoryIndex: "index.html", directoryIndex: "index.html",
fallbackToNetwork: true, fallbackToNetwork: true,
}, },
@@ -49,35 +49,4 @@ const serwist = new Serwist({
}, },
}); });
serwist.addEventListeners(); serwist.addEventListeners();
/** From Gemini */
/*
import { defaultCache } from '@serwist/next/worker';
import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist';
import { CacheFirst, Serwist } from 'serwist';
declare const self: ServiceWorkerGlobalScope &
SerwistGlobalConfig & {
__SW_MANIFEST: (string | PrecacheEntry)[];
};
const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST,
skipWaiting: true,
clientsClaim: true,
navigationPreload: true,
runtimeCaching: [
...defaultCache,
{
// Intercept map tile requests from standard OSM / tile servers
matcher: ({ url }) => url.hostname.includes('tile.openstreetmap.org') || url.pathname.includes('/tiles/'),
handler: new CacheFirst({
cacheName: 'excalibur-offline-map-tiles-v1',
}),
},
],
});
serwist.addEventListeners();
*/
+6
View File
@@ -108,6 +108,9 @@ export default function ChargedButton({
className={styles["charged-button-frame"]} className={styles["charged-button-frame"]}
aria-hidden="true" aria-hidden="true"
style={{ backgroundImage: whiteText ? "url(/buttons/Button_weiß.png)" : "url(/buttons/Button_leer.webp)" }} style={{ backgroundImage: whiteText ? "url(/buttons/Button_weiß.png)" : "url(/buttons/Button_leer.webp)" }}
onContextMenu={(e) => {
e.preventDefault();
}}
/> />
<span <span
@@ -118,6 +121,9 @@ export default function ChargedButton({
clipPath: `inset(0 ${clipPercent}% 0 0)`, clipPath: `inset(0 ${clipPercent}% 0 0)`,
WebkitClipPath: `inset(0 ${clipPercent}% 0 0)`, WebkitClipPath: `inset(0 ${clipPercent}% 0 0)`,
}} }}
onContextMenu={(e) => {
e.preventDefault();
}}
/> />
<span className={clsx(styles["charged-button-label"], "lancelot-regular", whiteText && styles["charged-button-label-whiteText"])}>{children}</span> <span className={clsx(styles["charged-button-label"], "lancelot-regular", whiteText && styles["charged-button-label-whiteText"])}>{children}</span>
+6
View File
@@ -21,6 +21,9 @@ export default function OldButton({children, long=true, red=true, disabled=false
style={style} style={style}
onClick={(disabled ? undefined : onAction)} onClick={(disabled ? undefined : onAction)}
disabled={disabled} disabled={disabled}
onContextMenu={(e) => {
e.preventDefault();
}}
> >
<img <img
src={ src={
@@ -31,6 +34,9 @@ export default function OldButton({children, long=true, red=true, disabled=false
} }
alt={"Button Background"} alt={"Button Background"}
className={styles["image"]} className={styles["image"]}
onContextMenu={(e) => {
e.preventDefault();
}}
/> />
<span className={clsx(styles["label"], "lancelot-regular", disabled && styles["label-disabled"])}> <span className={clsx(styles["label"], "lancelot-regular", disabled && styles["label-disabled"])}>
{children} {children}
+1
View File
@@ -32,6 +32,7 @@ export default function OldTextInput({
aria-label={ariaLabel} aria-label={ariaLabel}
placeholder={placeholder} placeholder={placeholder}
style={style} style={style}
autoComplete="off"
/> />
); );
} }
+10 -1
View File
@@ -29,15 +29,24 @@ export default function PermissionCheck({
const requestGPSPermission = () => { const requestGPSPermission = () => {
if (gpsStatus === "granted") return; if (gpsStatus === "granted") return;
setIsGPSPermissionLoading(true); setIsGPSPermissionLoading(true);
navigator.geolocation.getCurrentPosition((pos) => { navigator.geolocation.getCurrentPosition((pos) => {
setIsGPSPermissionLoading(false); setIsGPSPermissionLoading(false);
refresh(); refresh();
}, (e) => { }, (e) => {
setIsGPSPermissionLoading(false); setIsGPSPermissionLoading(false);
console.error("GPS Error Code:", e.code, "Message:", e.message);
if (e.code === 3) {
alert("GPS-Timeout: Das Erfassen des Standorts hat zu lange gedauert. Bitte im Freien erneut versuchen.");
} else if (e.code === 1) {
alert("GPS-Berechtigung verweigert. Bitte in den Safari-Einstellungen für diese Website erlauben.");
}
refresh(); refresh();
}, { }, {
enableHighAccuracy: true, enableHighAccuracy: true,
timeout: 3000 timeout: 15000,
maximumAge: 0
}); });
} }
-1
View File
@@ -107,7 +107,6 @@ export default function RiddleHintPage({
takePoints(riddle.skipPenaltyPoints); takePoints(riddle.skipPenaltyPoints);
dismissHintPage(); dismissHintPage();
if (onSkip) onSkip(); if (onSkip) onSkip();
//TODO: Add completeRiddle
}}>JA, ÜBERSPRINGEN</OldButton> }}>JA, ÜBERSPRINGEN</OldButton>
</div> </div>
</OldPopUp> </OldPopUp>
+15 -7
View File
@@ -35,13 +35,21 @@ export default function Riddle_7_AR_View({
const arSystem = sceneEl.systems['mindar-image-system']; const arSystem = sceneEl.systems['mindar-image-system'];
const handleRenderStart = () => { const startAR = () => {
if (arSystem) { if (arSystem) {
arSystem.start(); try {
arSystem.start();
} catch (error) {
console.warn('AR System start error:', error);
}
} }
}; };
sceneEl.addEventListener('renderstart', handleRenderStart); if (sceneEl.hasLoaded) {
startAR();
} else {
sceneEl.addEventListener('loaded', startAR, { once: true });
}
targetsRef.current.forEach((targetEl, index) => { targetsRef.current.forEach((targetEl, index) => {
if (!targetEl) return; if (!targetEl) return;
@@ -51,7 +59,7 @@ export default function Riddle_7_AR_View({
const targetConfig = TARGET_CONFIG.find((t) => t.targetIndex === index); const targetConfig = TARGET_CONFIG.find((t) => t.targetIndex === index);
if (targetConfig) { if (targetConfig) {
setShowNextButton(false); setShowNextButton?.(false);
setActiveVideo(targetConfig); setActiveVideo(targetConfig);
} }
}; };
@@ -66,7 +74,7 @@ export default function Riddle_7_AR_View({
return () => { return () => {
if (sceneEl) { if (sceneEl) {
sceneEl.removeEventListener('renderstart', handleRenderStart); sceneEl.removeEventListener('loaded', startAR);
} }
if (arSystem) { if (arSystem) {
try { try {
@@ -125,8 +133,8 @@ export default function Riddle_7_AR_View({
position: 'fixed', position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
width: '100vw', width: '100dvw',
height: '100vh', height: '100dvh',
backgroundColor: '#000', backgroundColor: '#000',
zIndex: 9999, zIndex: 9999,
display: 'flex', display: 'flex',
+5 -5
View File
@@ -285,13 +285,13 @@ export default function Riddle_1({
setPlayerAnswers(enteredAnswers); setPlayerAnswers(enteredAnswers);
addCompletedRiddle(riddle.step); addCompletedRiddle(riddle.step);
setPage(2); setPage(2);
}} disabled={hasNextPlayer}>ANTWORTEN EINREICHEN!</ChargedButton> }} disabled={hasNextPlayer}>ANTWORTEN EINREICHEN</ChargedButton>
</div> </div>
</div> </div>
<div className={styles["buttons"]}> <div className={styles["buttons"]}>
<OldButton red={true} onAction={() => { <OldButton red={true} onAction={() => {
setPage(0); setPage(0);
showBanner(false); showBanner(true);
}} }}
className={styles["backButton"]} className={styles["backButton"]}
>ZURÜCK</OldButton> >ZURÜCK</OldButton>
@@ -323,12 +323,12 @@ export default function Riddle_1({
), ),
( (
<div key={3}> <div key={3}>
{/* TODO: <VoiceOver voiceOverMode={voiceOverMode} sources={[ <VoiceOver voiceOverMode={voiceOverMode} sources={[
{ {
"src": "/res/tour/riddle_1/voiceovers/Erfolg.mp3", "src": "/res/tour/riddle_1/voiceovers/Skip.mp3",
"type": "audio/mpeg" "type": "audio/mpeg"
} }
]}/>*/} ]}/>
<div className={styles["content"]}> <div className={styles["content"]}>
<div style={{textAlign: "center", marginBottom: "1rem"}}> <div style={{textAlign: "center", marginBottom: "1rem"}}>
<img src={"/res/tour/riddle_" + (riddle.step + 1) + "/result.svg"} width={"40%"}/> <img src={"/res/tour/riddle_" + (riddle.step + 1) + "/result.svg"} width={"40%"}/>
+41 -4
View File
@@ -73,8 +73,29 @@ export default function Riddle_2({
const [ isSwordOnline, setIsSwordOnline ] = useState(true); const [ isSwordOnline, setIsSwordOnline ] = useState(true);
const [ wasSwordTakenOffline, setWasSwordTakenOffline ] = useState(false); const [ wasSwordTakenOffline, setWasSwordTakenOffline ] = useState(false);
const [swordStatus, setSwordStatus] = useState<string | null>(null);
// lE == true && sE == true
const checkSwordStatusForIdealState = (state: string) => {
// M:2,snd:true,sS:true,sE:true,sP:false,lE:true,v:50,pD:150s
if (state == null) return false;
let sE = false;
let lE = false;
const tokens = state.split(",");
for (const token of tokens) {
if (token === "sE:true") {
sE = true;
} else if (token === "lE:true") {
lE = true;
}
}
return sE && lE;
};
const [ isSwordIdealState, setIsSwordIdealState ] = useState(false);
const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, ""); const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, "");
const demoMode = useMemo(() => isDemoMode(demoModeStr), [demoModeStr]); const demoMode = useMemo(() => isDemoMode(demoModeStr), [demoModeStr]);
//const demoMode = false;
const [ playerIndex, setPlayerIndex ] = useState(0); const [ playerIndex, setPlayerIndex ] = useState(0);
const players = useMemo(() => getPlayers(), [playersStr]); const players = useMemo(() => getPlayers(), [playersStr]);
@@ -96,9 +117,16 @@ export default function Riddle_2({
const isNextIndexLastPlayer = players.length-2 <= playerIndex; const isNextIndexLastPlayer = players.length-2 <= playerIndex;
const [status, setStatus] = useState<ConnectionStatus>("disconnected"); const [status, setStatus] = useState<ConnectionStatus>("disconnected");
const [swordStatus, setSwordStatus] = useState<string>('N/A'); const statusRef = useRef(false);
//const [throneStatus, setThroneStatus] = useState<string>('N/A');
const [ soundInput, setSoundInput ] = useState("Chosen"); useEffect(() => {
if (status === "connected") {
statusRef.current = true;
} else {
statusRef.current = false;
}
}, [status]);
const wsRef = useRef<WebSocket | null>(null); const wsRef = useRef<WebSocket | null>(null);
const sendCommand = (topic: string, payload: string) => { const sendCommand = (topic: string, payload: string) => {
@@ -135,6 +163,7 @@ export default function Riddle_2({
if (data.topic === `${TOPIC_PREFIX}/stat`) { if (data.topic === `${TOPIC_PREFIX}/stat`) {
setSwordStatus(data.payload); setSwordStatus(data.payload);
setIsSwordIdealState(checkSwordStatusForIdealState(data.payload));
} else if (data.topic.includes('/event')) { } else if (data.topic.includes('/event')) {
console.log(`Event received on ${data.topic}:`, data.payload); console.log(`Event received on ${data.topic}:`, data.payload);
if (data.payload === "pull-denied") { if (data.payload === "pull-denied") {
@@ -170,6 +199,10 @@ export default function Riddle_2({
if (!isCancelled) { if (!isCancelled) {
setStatus("disconnected"); setStatus("disconnected");
reconnectTimeout = setTimeout(connect, 3000); reconnectTimeout = setTimeout(connect, 3000);
if (statusRef.current) {
setPage(0);
alert("Die Internet-Verbindung wurde verloren!");
}
} }
}; };
@@ -231,6 +264,10 @@ export default function Riddle_2({
setPage(3); setPage(3);
return; return;
} }
if (!isSwordIdealState) {
alert("Eine wahre Prüfung kann erst gestarten werden, wenn das Schwert richtig im Felsen ist!");
return;
}
if (!sendCommand(`${TOPIC_PREFIX}/set`, 'stayLocked')) { if (!sendCommand(`${TOPIC_PREFIX}/set`, 'stayLocked')) {
return; return;
} }
@@ -313,7 +350,7 @@ export default function Riddle_2({
<div key={3}> <div key={3}>
<VoiceOver voiceOverMode={voiceOverMode} sources={[ <VoiceOver voiceOverMode={voiceOverMode} sources={[
{ {
"src": "/res/tour/riddle_2/voiceovers/Erfolg.mp3", "src": "/res/tour/riddle_2/voiceovers/Skip.mp3",
"type": "audio/mpeg" "type": "audio/mpeg"
} }
]}/> ]}/>
+23 -12
View File
@@ -40,6 +40,7 @@ export default function Riddle_6({
const [isHeartFast, setIsHeartFast] = useState(true); const [isHeartFast, setIsHeartFast] = useState(true);
const closePopupRef = useRef<(() => void) | null>(null); const closePopupRef = useRef<(() => void) | null>(null);
const heartFastTimerRef = useRef<NodeJS.Timeout | null>(null); const heartFastTimerRef = useRef<NodeJS.Timeout | null>(null);
const popupTimerRef = useRef<NodeJS.Timeout | null>(null);
const voiceOverModeRef = useRef(voiceOverMode); const voiceOverModeRef = useRef(voiceOverMode);
useEffect(() => { useEffect(() => {
@@ -47,22 +48,32 @@ export default function Riddle_6({
}, [voiceOverMode]); }, [voiceOverMode]);
const handleClosePopup = () => { const handleClosePopup = () => {
if (closePopupRef.current) { if (popupTimerRef.current) {
closePopupRef.current(); clearTimeout(popupTimerRef.current);
} else { popupTimerRef.current = null;
setPopupData(null); }
}
}; if (closePopupRef.current) {
closePopupRef.current();
} else {
setPopupData(null);
}
};
useEffect(() => { useEffect(() => {
if (!popupData || voiceOverMode === "on") return; if (!popupData) return;
const timer = setTimeout(() => { popupTimerRef.current = setTimeout(() => {
handleClosePopup(); handleClosePopup();
}, 9000); }, 15000);
return () => clearTimeout(timer); return () => {
}, [popupData, voiceOverMode]); if (popupTimerRef.current) {
clearTimeout(popupTimerRef.current);
popupTimerRef.current = null;
}
};
}, [popupData]);
useEffect(() => { useEffect(() => {
if (page !== 2 || mode === 'won') return; if (page !== 2 || mode === 'won') return;
+2
View File
@@ -26,6 +26,7 @@ export default function Intro() {
const [ videoPaused, setVideoPaused ] = useState(false); const [ videoPaused, setVideoPaused ] = useState(false);
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off"); const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off");
const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, ""); const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, "");
const [ reachedRiddlesStr, setReachedRiddles ] = useLocalStorage(PREF.reached_riddles, "");
const introVideoRef = useRef<HTMLVideoElement | null>(null); const introVideoRef = useRef<HTMLVideoElement | null>(null);
const [ granted, setGranted ] = useState(false); const [ granted, setGranted ] = useState(false);
@@ -38,6 +39,7 @@ export default function Intro() {
setBoughtHints(""); setBoughtHints("");
setPlayers(""); setPlayers("");
setWorthyWords(""); setWorthyWords("");
setReachedRiddles("");
setVoiceOverState("on"); setVoiceOverState("on");
setStep("2"); setStep("2");
}; };
+10 -2
View File
@@ -20,6 +20,7 @@ import { fetchRiddleData, getRiddleData, setRiddleData } from "@/utils/riddledat
import { heartbeat } from "@/utils/sessionHandler"; import { heartbeat } from "@/utils/sessionHandler";
import { getCompletedRiddles } from "@/utils/completedRiddles"; import { getCompletedRiddles } from "@/utils/completedRiddles";
import { isDemoMode } from "@/utils/demoMode"; import { isDemoMode } from "@/utils/demoMode";
import { addReachedRiddle, getReachedRiddles } from "@/utils/reachedRiddles";
export default function Tour() { export default function Tour() {
const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, ""); const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, "");
@@ -91,6 +92,7 @@ export default function Tour() {
const [ boughtHintsStr, ] = useLocalStorage(PREF.bought_hints, ""); const [ boughtHintsStr, ] = useLocalStorage(PREF.bought_hints, "");
const [ playerCountStr, ] = useLocalStorage(PREF.player_count, ""); const [ playerCountStr, ] = useLocalStorage(PREF.player_count, "");
const [ voiceOverStr, ] = useLocalStorage(PREF.voice_over, ""); const [ voiceOverStr, ] = useLocalStorage(PREF.voice_over, "");
const [ reachedRiddlesStr, ] = useLocalStorage(PREF.reached_riddles, "");
const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted"; const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted";
@@ -121,7 +123,8 @@ export default function Tour() {
"completed_riddles": completedRiddlesStr, "completed_riddles": completedRiddlesStr,
"points": pointsStr, "points": pointsStr,
"bought_hints": boughtHintsStr, "bought_hints": boughtHintsStr,
"voice_over": voiceOverStr "voice_over": voiceOverStr,
"reached_riddles": reachedRiddlesStr,
}, code); }, code);
// TODO: Check if Code is valid. // TODO: Check if Code is valid.
}; };
@@ -190,9 +193,14 @@ export default function Tour() {
const distanceMeters = userLngLat.distanceTo(markerLngLat); const distanceMeters = userLngLat.distanceTo(markerLngLat);
const isNearby = distanceMeters <= r.requiredDistance; const isNearby = distanceMeters <= r.requiredDistance;
const reachedRiddles = getReachedRiddles();
const reachedAlready = reachedRiddles.includes(r.step);
if (isNearby || demoMode || true) { if (isNearby || demoMode || reachedAlready) {
setClickedMarker(marker.id); setClickedMarker(marker.id);
if (!reachedAlready) {
addReachedRiddle(r.step);
}
} else { } else {
setShowTooFar(true); setShowTooFar(true);
} }
+12 -3
View File
@@ -15,8 +15,11 @@
color: black; color: black;
transition: box-shadow 120ms ease, transform 120ms ease, 150ms ease-out filter, 150ms ease-out color; transition: box-shadow 120ms ease, transform 120ms ease, 150ms ease-out filter, 150ms ease-out color;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
--shadow: drop-shadow(0px 0px 4px #000a); --shadow: drop-shadow(0px 0px 4px #000a);
filter: var(--shadow); filter: var(--shadow);
} }
@@ -61,9 +64,12 @@
font-size: 1.1rem; font-size: 1.1rem;
-webkit-user-select: none; /* Safari */ -webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */ -moz-user-select: -moz-none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */ -ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */ user-select: none; /* Standard */
-webkit-touch-callout: none; /* iOS Bild speichern Feature aus */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
/*text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.7);*/ /*text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.7);*/
} }
@@ -87,9 +93,12 @@
color: white; color: white;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: -moz-none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
-webkit-touch-callout: none; /* iOS Bild speichern Feature aus */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
will-change: clip-path; will-change: clip-path;
} }
+14 -1
View File
@@ -8,12 +8,24 @@
justify-content: center; justify-content: center;
transition: 150ms ease-out filter; transition: 150ms ease-out filter;
-webkit-filter: var(--shadow); -webkit-filter: var(--shadow);
cursor: pointer;
filter: var(--shadow); filter: var(--shadow);
-webkit-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
.image { .image {
position: relative; position: relative;
width: 220px; width: 220px;
-webkit-user-select: none; /* Safari */
-moz-user-select: -moz-none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
-webkit-touch-callout: none; /* iOS Bild speichern Feature aus */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
.label { .label {
@@ -22,9 +34,10 @@
transition: 150ms ease-out color; transition: 150ms ease-out color;
color: white; color: white;
-webkit-user-select: none; /* Safari */ -webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */ -moz-user-select: -moz-none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */ -ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */ user-select: none; /* Standard */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
p { p {
max-width: 100% !important; max-width: 100% !important;
+1
View File
@@ -14,6 +14,7 @@
.content { .content {
height: 100%; height: 100%;
max-height: 50dvh; max-height: 50dvh;
padding-bottom: 15dvh;
p { p {
font-size: 1.3rem; font-size: 1.3rem;
margin-bottom: 1rem; margin-bottom: 1rem;
+1 -1
View File
@@ -3,7 +3,7 @@
flex-direction: column; flex-direction: column;
height: 100dvh; height: 100dvh;
width: 100%; width: 100%;
overflow: hidden; overflow: auto;
} }
.top-bar { .top-bar {
position: absolute; position: absolute;
+2 -1
View File
@@ -10,10 +10,11 @@ export enum PREF {
voice_over = "PREF_VOICEOVER_STATE", voice_over = "PREF_VOICEOVER_STATE",
bought_hints = "PREF_BOUGHT_HINTS", bought_hints = "PREF_BOUGHT_HINTS",
demo_mode = "PREF_DEMO_MODE", demo_mode = "PREF_DEMO_MODE",
reached_riddles = "PREF_REACHED_RIDDLES",
}; };
const isDev = process.env.NODE_ENV === "development"; const isDev = process.env.NODE_ENV === "development";
export const HTTP_SCHEME = isDev ? "http" : "https"; export const HTTP_SCHEME = isDev ? "http" : "https";
export const WS_SCHEME = isDev ? "ws" : "wss"; export const WS_SCHEME = isDev ? "ws" : "wss";
export const API_PREFIX = isDev ? "10.8.0.23:8080" : "api.excaliburs-erben.de"; export const API_PREFIX = isDev ? "192.168.0.110:8080" : "api.excaliburs-erben.de";
+20
View File
@@ -0,0 +1,20 @@
import { PREF } from "./const";
export function addReachedRiddle(step: number) {
const riddles = getReachedRiddles();
if (riddles.includes(step)) {
return;
}
riddles.push(step);
localStorage.setItem(PREF.reached_riddles, JSON.stringify(riddles));
window.dispatchEvent(new Event('storage'));
return riddles;
}
export function getReachedRiddles(): number[] {
const riddleList = localStorage.getItem(PREF.reached_riddles);
if (riddleList === null || riddleList.length < 1) {
return [];
}
return JSON.parse(riddleList);
}
+2
View File
@@ -8,6 +8,7 @@ interface SessionData {
"points": string; "points": string;
"bought_hints": string; "bought_hints": string;
"voice_over": string; "voice_over": string;
"reached_riddles": string;
}; };
export async function heartbeat(data: SessionData, code: string) { export async function heartbeat(data: SessionData, code: string) {
@@ -29,6 +30,7 @@ export function setSessionData(data: SessionData) {
localStorage.setItem(PREF.points, data.points); localStorage.setItem(PREF.points, data.points);
localStorage.setItem(PREF.bought_hints, data.bought_hints); localStorage.setItem(PREF.bought_hints, data.bought_hints);
localStorage.setItem(PREF.voice_over, data.voice_over); localStorage.setItem(PREF.voice_over, data.voice_over);
localStorage.setItem(PREF.reached_riddles, data.reached_riddles);
} }
export async function finishSession(code: string): Promise<Response> { export async function finishSession(code: string): Promise<Response> {