Compare commits
19
Commits
7179c36173
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
894b02597a | ||
|
|
7e8a7d7210 | ||
|
|
fea3401415 | ||
|
|
15927216b3 | ||
|
|
d301cf6d9a | ||
|
|
e6f2448e94 | ||
|
|
39c65927ac | ||
|
|
17f2eacb4a | ||
|
|
c809740520 | ||
|
|
c08e3bed57 | ||
|
|
4bcce765b7 | ||
|
|
0524875783 | ||
|
|
6b3e3fd8ca | ||
|
|
15ce86d6f3 | ||
|
|
0e65b8c446 | ||
|
|
5724560171 | ||
|
|
4c968d4caa | ||
|
|
e3eb20efb9 | ||
|
|
24580680a0 |
No files matched your search
@@ -18,4 +18,5 @@ RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/out /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
+1
-1
@@ -18,7 +18,7 @@ module.exports = {
|
||||
"typescript": {
|
||||
"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);
|
||||
+15
@@ -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.
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.
@@ -63,6 +63,7 @@ html,
|
||||
body {
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: env(keyboard-inset-height, 0px);
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
+2
-1
@@ -11,8 +11,9 @@ export const metadata: Metadata = {
|
||||
export default function RootLayout({ children }: LayoutProps<"/">) {
|
||||
return (
|
||||
<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-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta httpEquiv="ScreenOrientation" content="autoRotate:disabled" />
|
||||
<body>
|
||||
<SerwistProvider swUrl="/serwist/sw.js">{children}</SerwistProvider>
|
||||
|
||||
+28
-5
@@ -26,16 +26,39 @@ export default function Main() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasAttachedListerner && step > 0) {
|
||||
setHasAttachedListener(true);
|
||||
const doFullscreen = () => {
|
||||
return;
|
||||
if (process.env.NODE_ENV === "development") return;
|
||||
if (screenfull.isEnabled) {
|
||||
screenfull.request();
|
||||
}
|
||||
};
|
||||
window.addEventListener("click", () => {
|
||||
doFullscreen();
|
||||
});
|
||||
setHasAttachedListener(true);
|
||||
window.addEventListener("click", doFullscreen);
|
||||
let cleanup = () => {};
|
||||
if (window.visualViewport) {
|
||||
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();
|
||||
}
|
||||
}, [step, hasAttachedListerner, setHasAttachedListener]);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
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
|
||||
// `nextConfig` option so that Serwist can configure the service
|
||||
// worker according to your options. Serwist 10 and newer will
|
||||
|
||||
+1
-32
@@ -20,7 +20,7 @@ const serwist = new Serwist({
|
||||
precacheEntries: self.__SW_MANIFEST,
|
||||
precacheOptions: {
|
||||
cleanupOutdatedCaches: true,
|
||||
concurrency: 20,
|
||||
concurrency: 5,
|
||||
directoryIndex: "index.html",
|
||||
fallbackToNetwork: true,
|
||||
},
|
||||
@@ -50,34 +50,3 @@ const serwist = new Serwist({
|
||||
});
|
||||
|
||||
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();
|
||||
*/
|
||||
@@ -108,6 +108,9 @@ export default function ChargedButton({
|
||||
className={styles["charged-button-frame"]}
|
||||
aria-hidden="true"
|
||||
style={{ backgroundImage: whiteText ? "url(/buttons/Button_weiß.png)" : "url(/buttons/Button_leer.webp)" }}
|
||||
onContextMenu={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
/>
|
||||
|
||||
<span
|
||||
@@ -118,6 +121,9 @@ export default function ChargedButton({
|
||||
clipPath: `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>
|
||||
|
||||
@@ -21,6 +21,9 @@ export default function OldButton({children, long=true, red=true, disabled=false
|
||||
style={style}
|
||||
onClick={(disabled ? undefined : onAction)}
|
||||
disabled={disabled}
|
||||
onContextMenu={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={
|
||||
@@ -31,6 +34,9 @@ export default function OldButton({children, long=true, red=true, disabled=false
|
||||
}
|
||||
alt={"Button Background"}
|
||||
className={styles["image"]}
|
||||
onContextMenu={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
/>
|
||||
<span className={clsx(styles["label"], "lancelot-regular", disabled && styles["label-disabled"])}>
|
||||
{children}
|
||||
|
||||
@@ -32,6 +32,7 @@ export default function OldTextInput({
|
||||
aria-label={ariaLabel}
|
||||
placeholder={placeholder}
|
||||
style={style}
|
||||
autoComplete="off"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -29,15 +29,24 @@ export default function PermissionCheck({
|
||||
const requestGPSPermission = () => {
|
||||
if (gpsStatus === "granted") return;
|
||||
setIsGPSPermissionLoading(true);
|
||||
|
||||
navigator.geolocation.getCurrentPosition((pos) => {
|
||||
setIsGPSPermissionLoading(false);
|
||||
refresh();
|
||||
}, (e) => {
|
||||
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();
|
||||
}, {
|
||||
enableHighAccuracy: true,
|
||||
timeout: 3000
|
||||
timeout: 15000,
|
||||
maximumAge: 0
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,6 @@ export default function RiddleHintPage({
|
||||
takePoints(riddle.skipPenaltyPoints);
|
||||
dismissHintPage();
|
||||
if (onSkip) onSkip();
|
||||
//TODO: Add completeRiddle
|
||||
}}>JA, ÜBERSPRINGEN</OldButton>
|
||||
</div>
|
||||
</OldPopUp>
|
||||
|
||||
@@ -1,59 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import React, { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';
|
||||
import 'aframe';
|
||||
import 'mind-ar/dist/mindar-image-aframe.prod.js';
|
||||
|
||||
const TARGET_CONFIG = [
|
||||
{ targetIndex: 2, videoId: 'video0', videoSrc: '/res/tour/riddle_7/videos/Oswin der Stallknecht.mp4' },
|
||||
{ targetIndex: 1, videoId: 'video1', videoSrc: '/res/tour/riddle_7/videos/Mara die Kräuterfrau.mp4' },
|
||||
{ targetIndex: 0, videoId: 'video2', videoSrc: '/res/tour/riddle_7/videos/Edmund der Schreiber.mp4' },
|
||||
{ targetIndex: 3, videoId: 'video3', videoSrc: '/res/tour/riddle_7/videos/Sir Garrick die Torwache.mp4' },
|
||||
{ targetIndex: 2, videoId: 'video0', videoSrc: '/res/tour/riddle_7/videos/Oswin der Stallknecht.mp4', name: 'Oswin' },
|
||||
{ targetIndex: 1, videoId: 'video1', videoSrc: '/res/tour/riddle_7/videos/Mara die Kräuterfrau.mp4', name: 'Mara' },
|
||||
{ targetIndex: 0, videoId: 'video2', videoSrc: '/res/tour/riddle_7/videos/Edmund der Schreiber.mp4', name: 'Edmund' },
|
||||
{ targetIndex: 3, videoId: 'video3', videoSrc: '/res/tour/riddle_7/videos/Sir Garrick die Torwache.mp4', name: 'Sir Garrick' },
|
||||
];
|
||||
|
||||
export default function Riddle_7_AR_View() {
|
||||
interface Riddle_7_AR_View_Props {
|
||||
setShowNextButton?: Dispatch<SetStateAction<boolean>>
|
||||
};
|
||||
|
||||
export default function Riddle_7_AR_View({
|
||||
setShowNextButton
|
||||
}: Riddle_7_AR_View_Props) {
|
||||
const sceneRef = useRef(null);
|
||||
const targetsRef = useRef([]);
|
||||
const videosRef = useRef({});
|
||||
const lostTimesRef = useRef({});
|
||||
const cooldownRef = useRef({});
|
||||
const activeVideoRef = useRef(null);
|
||||
|
||||
const TARGET_HEIGHT = 1;
|
||||
const [activeVideo, setActiveVideo] = useState(null);
|
||||
|
||||
const [videoDimensions, setVideoDimensions] = useState({});
|
||||
const [hasInteracted, setHasInteracted] = useState(false);
|
||||
useEffect(() => {
|
||||
activeVideoRef.current = activeVideo;
|
||||
}, [activeVideo]);
|
||||
|
||||
useEffect(() => {
|
||||
const sceneEl = sceneRef.current;
|
||||
if (!sceneEl) return;
|
||||
|
||||
const arSystem = sceneEl.systems['mindar-image-system'];
|
||||
|
||||
sceneEl.addEventListener('renderstart', () => {
|
||||
const startAR = () => {
|
||||
if (arSystem) {
|
||||
try {
|
||||
arSystem.start();
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn('AR System start error:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (sceneEl.hasLoaded) {
|
||||
startAR();
|
||||
} else {
|
||||
sceneEl.addEventListener('loaded', startAR, { once: true });
|
||||
}
|
||||
|
||||
targetsRef.current.forEach((targetEl, index) => {
|
||||
if (!targetEl) return;
|
||||
|
||||
const videoEl = videosRef.current[index];
|
||||
|
||||
const handleTargetFound = () => {
|
||||
if (videoEl) {
|
||||
const lostTime = lostTimesRef.current[index];
|
||||
if (lostTime && Date.now() - lostTime > 10000) {
|
||||
videoEl.currentTime = 0;
|
||||
}
|
||||
lostTimesRef.current[index] = null;
|
||||
if (activeVideoRef.current || cooldownRef.current[index]) return;
|
||||
|
||||
videoEl.play().catch((err) => {
|
||||
console.log(`Autoplay blocked on target ${index}:`, err);
|
||||
});
|
||||
const targetConfig = TARGET_CONFIG.find((t) => t.targetIndex === index);
|
||||
if (targetConfig) {
|
||||
setShowNextButton?.(false);
|
||||
setActiveVideo(targetConfig);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTargetLost = () => {
|
||||
if (videoEl) {
|
||||
videoEl.pause();
|
||||
lostTimesRef.current[index] = Date.now();
|
||||
}
|
||||
cooldownRef.current[index] = false;
|
||||
};
|
||||
|
||||
targetEl.addEventListener('targetFound', handleTargetFound);
|
||||
@@ -61,6 +73,9 @@ export default function Riddle_7_AR_View() {
|
||||
});
|
||||
|
||||
return () => {
|
||||
if (sceneEl) {
|
||||
sceneEl.removeEventListener('loaded', startAR);
|
||||
}
|
||||
if (arSystem) {
|
||||
try {
|
||||
arSystem.stop();
|
||||
@@ -68,18 +83,14 @@ export default function Riddle_7_AR_View() {
|
||||
console.warn('MindAR stopped after DOM teardown:', error);
|
||||
}
|
||||
}
|
||||
}}, []);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleLoadedMetadata = (index, videoEl) => {
|
||||
if (videoEl) {
|
||||
const aspect = videoEl.videoWidth / videoEl.videoHeight;
|
||||
setVideoDimensions((prev) => ({
|
||||
...prev,
|
||||
[index]: {
|
||||
width: TARGET_HEIGHT * aspect,
|
||||
height: TARGET_HEIGHT,
|
||||
},
|
||||
}));
|
||||
const handleCloseFullscreen = () => {
|
||||
if (activeVideo) {
|
||||
setShowNextButton(true);
|
||||
cooldownRef.current[activeVideo.targetIndex] = true;
|
||||
setActiveVideo(null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,7 +106,6 @@ export default function Riddle_7_AR_View() {
|
||||
backgroundColor: '#000',
|
||||
}}
|
||||
>
|
||||
|
||||
<a-scene
|
||||
ref={sceneRef}
|
||||
mindar-image="imageTargetSrc: /res/tour/riddle_7/targets.mind; autoStart: false; uiLoading: no; uiError: no; uiScanning: no; filterMinCF: 0.0001; filterBeta: 0.001;"
|
||||
@@ -106,48 +116,71 @@ export default function Riddle_7_AR_View() {
|
||||
device-orientation-permission-ui="enabled: false"
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
>
|
||||
<a-assets>
|
||||
{TARGET_CONFIG.map((target) => (
|
||||
<video
|
||||
key={target.videoId}
|
||||
id={target.videoId}
|
||||
ref={(el) => (videosRef.current[target.targetIndex] = el)}
|
||||
src={target.videoSrc}
|
||||
preload="auto"
|
||||
loop
|
||||
crossOrigin="anonymous"
|
||||
playsInline
|
||||
onLoadedMetadata={(e) =>
|
||||
handleLoadedMetadata(target.targetIndex, e.target)
|
||||
}
|
||||
></video>
|
||||
))}
|
||||
</a-assets>
|
||||
|
||||
<a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
|
||||
|
||||
{TARGET_CONFIG.map((target) => {
|
||||
const dims = videoDimensions[target.targetIndex] || {
|
||||
width: 1,
|
||||
height: TARGET_HEIGHT,
|
||||
};
|
||||
return (
|
||||
{TARGET_CONFIG.map((target) => (
|
||||
<a-entity
|
||||
key={target.targetIndex}
|
||||
ref={(el) => (targetsRef.current[target.targetIndex] = el)}
|
||||
mindar-image-target={`targetIndex: ${target.targetIndex}`}
|
||||
>
|
||||
<a-video
|
||||
src={`#${target.videoId}`}
|
||||
width={dims.width}
|
||||
height={dims.height}
|
||||
position="0 0 0"
|
||||
rotation="0 0 0"
|
||||
></a-video>
|
||||
</a-entity>
|
||||
);
|
||||
})}
|
||||
></a-entity>
|
||||
))}
|
||||
</a-scene>
|
||||
|
||||
{activeVideo && (
|
||||
<div
|
||||
style={{
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: '100dvw',
|
||||
height: '100dvh',
|
||||
backgroundColor: '#000',
|
||||
zIndex: 9999,
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<button
|
||||
onClick={handleCloseFullscreen}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '20px',
|
||||
left: '20px',
|
||||
zIndex: 10001,
|
||||
backgroundColor: 'transparent',
|
||||
border: 'none',
|
||||
width: '48px',
|
||||
height: '48px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
cursor: 'pointer',
|
||||
outline: 'none',
|
||||
}}
|
||||
aria-label="Close video"
|
||||
>
|
||||
<img src="/icons/kreuz.svg" alt="Close" style={{ width: '40px', height: '40px' }} />
|
||||
</button>
|
||||
|
||||
<video
|
||||
src={activeVideo.videoSrc}
|
||||
controls
|
||||
autoPlay
|
||||
playsInline
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "0",
|
||||
left: "0",
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
objectFit: 'contain',
|
||||
zIndex: 10000,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -285,13 +285,13 @@ export default function Riddle_1({
|
||||
setPlayerAnswers(enteredAnswers);
|
||||
addCompletedRiddle(riddle.step);
|
||||
setPage(2);
|
||||
}} disabled={hasNextPlayer}>ANTWORTEN EINREICHEN!</ChargedButton>
|
||||
}} disabled={hasNextPlayer}>ANTWORTEN EINREICHEN</ChargedButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles["buttons"]}>
|
||||
<OldButton red={true} onAction={() => {
|
||||
setPage(0);
|
||||
showBanner(false);
|
||||
showBanner(true);
|
||||
}}
|
||||
className={styles["backButton"]}
|
||||
>ZURÜCK</OldButton>
|
||||
@@ -323,12 +323,12 @@ export default function Riddle_1({
|
||||
),
|
||||
(
|
||||
<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"
|
||||
}
|
||||
]}/>*/}
|
||||
]}/>
|
||||
<div className={styles["content"]}>
|
||||
<div style={{textAlign: "center", marginBottom: "1rem"}}>
|
||||
<img src={"/res/tour/riddle_" + (riddle.step + 1) + "/result.svg"} width={"40%"}/>
|
||||
|
||||
@@ -69,9 +69,33 @@ export default function Riddle_2({
|
||||
const [ isSwordBackIn, setIsSwordBackIn ] = useState(true);
|
||||
const [ playersStr, ] = useLocalStorage(PREF.players, "");
|
||||
const [ tourCode, ] = useLocalStorage(PREF.code, "");
|
||||
const [ isSystemLockOn, setIsSystemLockOn] = useState<boolean | undefined>(undefined);
|
||||
const [ isSwordOnline, setIsSwordOnline ] = useState(true);
|
||||
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 demoMode = useMemo(() => isDemoMode(demoModeStr), [demoModeStr]);
|
||||
//const demoMode = false;
|
||||
|
||||
const [ playerIndex, setPlayerIndex ] = useState(0);
|
||||
const players = useMemo(() => getPlayers(), [playersStr]);
|
||||
@@ -93,9 +117,16 @@ export default function Riddle_2({
|
||||
const isNextIndexLastPlayer = players.length-2 <= playerIndex;
|
||||
|
||||
const [status, setStatus] = useState<ConnectionStatus>("disconnected");
|
||||
const [swordStatus, setSwordStatus] = useState<string>('N/A');
|
||||
//const [throneStatus, setThroneStatus] = useState<string>('N/A');
|
||||
const [ soundInput, setSoundInput ] = useState("Chosen");
|
||||
const statusRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (status === "connected") {
|
||||
statusRef.current = true;
|
||||
} else {
|
||||
statusRef.current = false;
|
||||
}
|
||||
}, [status]);
|
||||
|
||||
const wsRef = useRef<WebSocket | null>(null);
|
||||
|
||||
const sendCommand = (topic: string, payload: string) => {
|
||||
@@ -132,6 +163,7 @@ export default function Riddle_2({
|
||||
|
||||
if (data.topic === `${TOPIC_PREFIX}/stat`) {
|
||||
setSwordStatus(data.payload);
|
||||
setIsSwordIdealState(checkSwordStatusForIdealState(data.payload));
|
||||
} else if (data.topic.includes('/event')) {
|
||||
console.log(`Event received on ${data.topic}:`, data.payload);
|
||||
if (data.payload === "pull-denied") {
|
||||
@@ -142,23 +174,41 @@ export default function Riddle_2({
|
||||
setIsSwordBackIn(true);
|
||||
} else if (data.payload === "ceremonyDone") {
|
||||
setCanGoNext(true);
|
||||
} else if (data.payload === "online") {
|
||||
setIsSwordOnline(true);
|
||||
} else if (data.payload === "offline") {
|
||||
setIsSwordOnline(false);
|
||||
}
|
||||
} else if (data.topic.includes('/set')) {
|
||||
if (data.payload === "abortTry") {
|
||||
awaitTryAbort = true;
|
||||
}
|
||||
} else if (data.topic.startsWith("system/")) {
|
||||
if (data.topic === "system/swordLock") {
|
||||
if (data.payload === "locked") {
|
||||
setIsSystemLockOn(true);
|
||||
} else if (data.payload === "unlocked") {
|
||||
setIsSystemLockOn(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
setIsSystemLockOn(undefined);
|
||||
if (!isCancelled) {
|
||||
setStatus("disconnected");
|
||||
reconnectTimeout = setTimeout(connect, 3000);
|
||||
if (statusRef.current) {
|
||||
setPage(0);
|
||||
alert("Die Internet-Verbindung wurde verloren!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ws.onerror = () => {
|
||||
ws.close();
|
||||
setIsSystemLockOn(undefined);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -167,6 +217,7 @@ export default function Riddle_2({
|
||||
return () => {
|
||||
isCancelled = true;
|
||||
clearTimeout(reconnectTimeout);
|
||||
setIsSystemLockOn(undefined);
|
||||
wsRef.current?.close();
|
||||
};
|
||||
}, [tourCode]);
|
||||
@@ -181,6 +232,7 @@ export default function Riddle_2({
|
||||
await waitUntilTrue(() => {
|
||||
return awaitTryAbort
|
||||
});
|
||||
sendCommand("system/swordLock", "giveLock");
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -204,12 +256,25 @@ export default function Riddle_2({
|
||||
</div>
|
||||
<div className={styles["buttons"]}>
|
||||
<OldButton red={false} onAction={() => {
|
||||
if (!isSwordOnline && !demoMode) {
|
||||
addPoints(riddle.points);
|
||||
setWasSwordTakenOffline(true);
|
||||
addCompletedRiddle(riddle.step);
|
||||
showBanner(false);
|
||||
setPage(3);
|
||||
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')) {
|
||||
return;
|
||||
}
|
||||
sendCommand("system/swordLock", "takeLock");
|
||||
setCanGoNext(false);
|
||||
setPage(1);
|
||||
}}>PRÜFUNG STARTEN</OldButton>
|
||||
}} disabled={(isSystemLockOn !== false) && !demoMode && isSwordOnline} >PRÜFUNG STARTEN</OldButton>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -228,6 +293,7 @@ export default function Riddle_2({
|
||||
setPage(2);
|
||||
addPoints(riddle.points);
|
||||
addCompletedRiddle(riddle.step);
|
||||
sendCommand("system/swordLock", "giveLock");
|
||||
} else {
|
||||
if (isNextIndexLastPlayer) {
|
||||
if (!sendCommand(`${TOPIC_PREFIX}/set`, 'releaseLock')) {
|
||||
@@ -252,6 +318,7 @@ export default function Riddle_2({
|
||||
await waitUntilTrue(() => {
|
||||
return awaitTryAbort;
|
||||
});
|
||||
sendCommand("system/swordLock", "giveLock");
|
||||
setPage(0);
|
||||
}} className={styles["backButton"]}>ZURÜCK</OldButton> : null}
|
||||
</div>
|
||||
@@ -283,7 +350,7 @@ export default function Riddle_2({
|
||||
<div key={3}>
|
||||
<VoiceOver voiceOverMode={voiceOverMode} sources={[
|
||||
{
|
||||
"src": "/res/tour/riddle_2/voiceovers/Erfolg.mp3",
|
||||
"src": "/res/tour/riddle_2/voiceovers/Skip.mp3",
|
||||
"type": "audio/mpeg"
|
||||
}
|
||||
]}/>
|
||||
@@ -291,7 +358,7 @@ export default function Riddle_2({
|
||||
<div style={{textAlign: "center", marginBottom: "1rem"}}>
|
||||
<img src={"/res/tour/riddle_" + (riddle.step + 1) + "/result.svg"} width={"50%"}/>
|
||||
</div>
|
||||
<RiddleCompleteBanner points={0} win={true}></RiddleCompleteBanner>
|
||||
<RiddleCompleteBanner points={wasSwordTakenOffline ? riddle.points : 0} win={true}></RiddleCompleteBanner>
|
||||
<p><b>{players?.[players?.length - 1]?.name}</b>, du bist <b>{players?.[players?.length - 1]?.gender === "female" ? "die" : "der"} Auserwählte</b> und wärst des Schwertes würdig gewesen. Nun gut, schreitet ohne Schwert und mit nur wenigen Rufpunkten voran.</p>
|
||||
</div>
|
||||
<div className={styles["buttons"]}>
|
||||
@@ -303,6 +370,7 @@ export default function Riddle_2({
|
||||
|
||||
return requestingHint ? <RiddleHintPage riddle={riddle} dismissHintPage={dismissHint} voiceOverMode={voiceOverMode} onSkip={() => {
|
||||
addCompletedRiddle(riddle.step);
|
||||
setWasSwordTakenOffline(false);
|
||||
showBanner(false);
|
||||
setPage(3);
|
||||
}}/> : pages[page];
|
||||
|
||||
@@ -40,6 +40,7 @@ export default function Riddle_6({
|
||||
const [isHeartFast, setIsHeartFast] = useState(true);
|
||||
const closePopupRef = useRef<(() => void) | null>(null);
|
||||
const heartFastTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const popupTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
const voiceOverModeRef = useRef(voiceOverMode);
|
||||
useEffect(() => {
|
||||
@@ -47,6 +48,11 @@ export default function Riddle_6({
|
||||
}, [voiceOverMode]);
|
||||
|
||||
const handleClosePopup = () => {
|
||||
if (popupTimerRef.current) {
|
||||
clearTimeout(popupTimerRef.current);
|
||||
popupTimerRef.current = null;
|
||||
}
|
||||
|
||||
if (closePopupRef.current) {
|
||||
closePopupRef.current();
|
||||
} else {
|
||||
@@ -55,14 +61,19 @@ export default function Riddle_6({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!popupData || voiceOverMode === "on") return;
|
||||
if (!popupData) return;
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
popupTimerRef.current = setTimeout(() => {
|
||||
handleClosePopup();
|
||||
}, 9000);
|
||||
}, 15000);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [popupData, voiceOverMode]);
|
||||
return () => {
|
||||
if (popupTimerRef.current) {
|
||||
clearTimeout(popupTimerRef.current);
|
||||
popupTimerRef.current = null;
|
||||
}
|
||||
};
|
||||
}, [popupData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (page !== 2 || mode === 'won') return;
|
||||
@@ -292,7 +303,8 @@ export default function Riddle_6({
|
||||
<RiddleCompleteBanner points={riddle.points} win={true}></RiddleCompleteBanner>
|
||||
<p>Endlich herrscht vollkommene Ruhe, und für einen kurzen Augenblick scheint selbst der Wald mit euch den Atem anzuhalten.</p>
|
||||
<p>Ihr habt verstanden, was Sir Galahad von einem Herrscher verlangt: Nicht jede Herausforderung wird durch Stärke gewonnen; manchmal zeigt sich wahre Größe darin, den richtigen Augenblick abzuwarten.</p>
|
||||
<p>Die Prüfung ist bestanden, und unter den alten Rittern beginnt sich die Nachricht zu verbreiten, dass der neue Auserwählte mehr besitzt als Excalibur – nämlich Selbstbeherrschung.</p>
|
||||
<p>Die Prüfung ist bestanden, und unter den alten Rittern beginnt sich die Nachricht zu verbreiten, dass der neue Auserwählte mehr besitzt als Excalibur - nämlich Selbstbeherrschung.</p>
|
||||
<p>Ihr gewinnt Rufpunkte.</p>
|
||||
</div>
|
||||
<div className={styles["buttons"]}>
|
||||
<OldButton red={false} disabled={false} onAction={() => exitFunction()}>ZURÜCK ZUR KARTE</OldButton>
|
||||
|
||||
@@ -30,6 +30,7 @@ export default function Riddle_7({
|
||||
dismissHint,
|
||||
}: RiddleScreenControls) {
|
||||
|
||||
const [ showNextButton, setShowNextButton ] = useState(true);
|
||||
const [ selection, setSelection ] = useState(-1);
|
||||
|
||||
const pages = [
|
||||
@@ -81,11 +82,11 @@ export default function Riddle_7({
|
||||
(
|
||||
<div key={2}>
|
||||
<div className={styles["content"]}>
|
||||
<Riddle_7_AR_View />
|
||||
</div>
|
||||
<div className={styles["buttons"]}>
|
||||
<OldButton red={false} disabled={false} onAction={() => setPage(3)}>URTEIL SPRECHEN</OldButton>
|
||||
<Riddle_7_AR_View setShowNextButton={setShowNextButton}/>
|
||||
</div>
|
||||
{ showNextButton ? <div className={styles["buttons"]}>
|
||||
<OldButton red={false} disabled={false} onAction={() => setPage(3)} style={{zIndex: 9998}}>URTEIL SPRECHEN</OldButton>
|
||||
</div> : null }
|
||||
</div>
|
||||
),
|
||||
(
|
||||
|
||||
@@ -26,6 +26,7 @@ export default function Intro() {
|
||||
const [ videoPaused, setVideoPaused ] = useState(false);
|
||||
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off");
|
||||
const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, "");
|
||||
const [ reachedRiddlesStr, setReachedRiddles ] = useLocalStorage(PREF.reached_riddles, "");
|
||||
const introVideoRef = useRef<HTMLVideoElement | null>(null);
|
||||
const [ granted, setGranted ] = useState(false);
|
||||
|
||||
@@ -38,6 +39,7 @@ export default function Intro() {
|
||||
setBoughtHints("");
|
||||
setPlayers("");
|
||||
setWorthyWords("");
|
||||
setReachedRiddles("");
|
||||
setVoiceOverState("on");
|
||||
setStep("2");
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@ import { fetchRiddleData, getRiddleData, setRiddleData } from "@/utils/riddledat
|
||||
import { heartbeat } from "@/utils/sessionHandler";
|
||||
import { getCompletedRiddles } from "@/utils/completedRiddles";
|
||||
import { isDemoMode } from "@/utils/demoMode";
|
||||
import { addReachedRiddle, getReachedRiddles } from "@/utils/reachedRiddles";
|
||||
|
||||
export default function Tour() {
|
||||
const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, "");
|
||||
@@ -31,6 +32,7 @@ export default function Tour() {
|
||||
const riddleData: Riddle[] = useMemo(() => {
|
||||
return getRiddleData();
|
||||
}, [riddleDataStr]);
|
||||
//const riddleData: Riddle[] = [{"id":1,"name":"Der Hüter des Tores","step":0,"latitude":49.089155,"longitude":9.281336,"points":500,"failPenaltyPoints":0,"skipPenaltyPoints":0,"requiredDistance":40,"hints":[]},{"id":2,"name":"Das Schwert im Stein","step":1,"latitude":49.088559,"longitude":9.281426,"points":500,"failPenaltyPoints":0,"skipPenaltyPoints":0,"requiredDistance":25,"hints":[]},{"id":3,"name":"Die Stimme des neuen Königs","step":2,"latitude":49.089056,"longitude":9.282916,"points":1000,"failPenaltyPoints":250,"skipPenaltyPoints":250,"requiredDistance":40,"hints":[]},{"id":4,"name":"Stimmen am Wegesrand","step":3,"latitude":49.089822,"longitude":9.28523,"points":1000,"failPenaltyPoints":100,"skipPenaltyPoints":100,"requiredDistance":25,"hints":[{"id":1,"hint":"Genauer hinzuhören wird euch vermutlich nicht weiterbringen. Vielleicht müsst ihr vielmehr verändern, wie ihr das Gehörte betrachtet – oder was ihr mit einer Tonaufnahme auf eurem Smartphone anstellen könnt.","penaltyPoints":150,"hintOrder":0},{"id":2,"hint":"Die Bauern sprechen nicht unverständlich; ihr hört ihre Worte nur in der falschen Richtung. Nehmt die Tonspur auf und findet einen Weg, sie in umgekehrter Reihenfolge abzuspielen.","penaltyPoints":300,"hintOrder":1}]},{"id":5,"name":"Jenseits der bekannten Wege","step":4,"latitude":49.089916,"longitude":9.285864,"points":1000,"failPenaltyPoints":500,"skipPenaltyPoints":500,"requiredDistance":25,"hints":[{"id":3,"hint":"Der Name des unbekannten Ortes ist vor Ort bereits sichtbar. Haltet Ausschau nach einem prominent platzierten Holzschild in der Nähe des unbekannten Gebietes; dort findet ihr die Lösung, die ihr eingeben müsst.","penaltyPoints":300,"hintOrder":0}]},{"id":6,"name":"Die Prüfung der Stille","step":5,"latitude":49.092468,"longitude":9.285891,"points":500,"failPenaltyPoints":0,"skipPenaltyPoints":500,"requiredDistance":20,"hints":[]},{"id":7,"name":"Lancelots Urteil","step":6,"latitude":49.093505,"longitude":9.282669,"points":1500,"failPenaltyPoints":750,"skipPenaltyPoints":750,"requiredDistance":25,"hints":[{"id":4,"hint":"Nicht nur das, was ihr am Tatort findet, kann einen Verdächtigen überführen; auch das, was dort fehlt, kann entscheidend sein. Oswin, der Stallknecht, war draußen im Regen und im Matsch unterwegs, doch der Boden vor der aufgebrochenen Truhe ist trocken und sauber.\n\nWelche Spuren hätten dort zu finden sein müssen, wenn Oswin tatsächlich der Täter gewesen wäre?","penaltyPoints":100,"hintOrder":0},{"id":5,"hint":"An der aufgebrochenen Schatulle befindet sich eine besonders auffällige Spur: Blut. Zwei der vier Verdächtigen haben eine verletzte Hand.\n\nKonzentriert euch auf diese beiden und vergleicht ihre Aussagen besonders genau mit dem übrigen Beweismaterial. Eine Verletzung allein beweist nichts, doch zusammen mit den anderen Spuren kann sie entscheidend sein.","penaltyPoints":200,"hintOrder":1}]},{"id":8,"name":"Merlins Prüfung","step":7,"latitude":49.089782,"longitude":9.281705,"points":2000,"failPenaltyPoints":500,"skipPenaltyPoints":500,"requiredDistance":25,"hints":[{"id":6,"hint":"Wenn ihr nicht weiterkommt, betrachtet nicht nur das nächste passende Symbol, sondern auch, wie sich der Würfel durch jeden Zug dreht. Der scheinbar direkte Weg kann in eine Sackgasse führen.\n\nPlant mehrere Züge voraus und denkt daran: Die dicken Linien dürfen niemals überquert werden.","penaltyPoints":200,"hintOrder":0}]},{"id":9,"name":"Die Tafelrunde","step":8,"latitude":49.089098,"longitude":9.282348,"points":2000,"failPenaltyPoints":1000,"skipPenaltyPoints":1000,"requiredDistance":25,"hints":[]}];
|
||||
|
||||
useEffect(() => {
|
||||
fetchRiddleData().then((riddleData) => {
|
||||
@@ -90,6 +92,7 @@ export default function Tour() {
|
||||
const [ boughtHintsStr, ] = useLocalStorage(PREF.bought_hints, "");
|
||||
const [ playerCountStr, ] = useLocalStorage(PREF.player_count, "");
|
||||
const [ voiceOverStr, ] = useLocalStorage(PREF.voice_over, "");
|
||||
const [ reachedRiddlesStr, ] = useLocalStorage(PREF.reached_riddles, "");
|
||||
|
||||
const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted";
|
||||
|
||||
@@ -120,7 +123,8 @@ export default function Tour() {
|
||||
"completed_riddles": completedRiddlesStr,
|
||||
"points": pointsStr,
|
||||
"bought_hints": boughtHintsStr,
|
||||
"voice_over": voiceOverStr
|
||||
"voice_over": voiceOverStr,
|
||||
"reached_riddles": reachedRiddlesStr,
|
||||
}, code);
|
||||
// TODO: Check if Code is valid.
|
||||
};
|
||||
@@ -189,9 +193,14 @@ export default function Tour() {
|
||||
|
||||
const distanceMeters = userLngLat.distanceTo(markerLngLat);
|
||||
const isNearby = distanceMeters <= r.requiredDistance;
|
||||
const reachedRiddles = getReachedRiddles();
|
||||
const reachedAlready = reachedRiddles.includes(r.step);
|
||||
|
||||
if (isNearby || demoMode) {
|
||||
if (isNearby || demoMode || reachedAlready) {
|
||||
setClickedMarker(marker.id);
|
||||
if (!reachedAlready) {
|
||||
addReachedRiddle(r.step);
|
||||
}
|
||||
} else {
|
||||
setShowTooFar(true);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
color: black;
|
||||
transition: box-shadow 120ms ease, transform 120ms ease, 150ms ease-out filter, 150ms ease-out color;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
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);
|
||||
filter: var(--shadow);
|
||||
}
|
||||
@@ -61,9 +64,12 @@
|
||||
font-size: 1.1rem;
|
||||
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-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);
|
||||
|
||||
/*text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.7);*/
|
||||
}
|
||||
@@ -87,9 +93,12 @@
|
||||
color: white;
|
||||
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-moz-user-select: -moz-none;
|
||||
-ms-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;
|
||||
}
|
||||
@@ -8,12 +8,24 @@
|
||||
justify-content: center;
|
||||
transition: 150ms ease-out filter;
|
||||
-webkit-filter: var(--shadow);
|
||||
cursor: pointer;
|
||||
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 {
|
||||
position: relative;
|
||||
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 {
|
||||
@@ -22,9 +34,10 @@
|
||||
transition: 150ms ease-out color;
|
||||
color: white;
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-moz-user-select: none; /* Firefox */
|
||||
-moz-user-select: -moz-none; /* Firefox */
|
||||
-ms-user-select: none; /* IE10+/Edge */
|
||||
user-select: none; /* Standard */
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
|
||||
p {
|
||||
max-width: 100% !important;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
.content {
|
||||
height: 100%;
|
||||
max-height: 50dvh;
|
||||
padding-bottom: 15dvh;
|
||||
p {
|
||||
font-size: 1.3rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
flex-direction: column;
|
||||
height: 100dvh;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
overflow: auto;
|
||||
}
|
||||
.top-bar {
|
||||
position: absolute;
|
||||
|
||||
+2
-1
@@ -10,10 +10,11 @@ export enum PREF {
|
||||
voice_over = "PREF_VOICEOVER_STATE",
|
||||
bought_hints = "PREF_BOUGHT_HINTS",
|
||||
demo_mode = "PREF_DEMO_MODE",
|
||||
reached_riddles = "PREF_REACHED_RIDDLES",
|
||||
};
|
||||
|
||||
const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
export const HTTP_SCHEME = isDev ? "http" : "https";
|
||||
export const WS_SCHEME = isDev ? "ws" : "wss";
|
||||
export const API_PREFIX = isDev ? "localhost:8080" : "api.excaliburs-erben.de";
|
||||
export const API_PREFIX = isDev ? "192.168.0.110:8080" : "api.excaliburs-erben.de";
|
||||
@@ -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);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ interface SessionData {
|
||||
"points": string;
|
||||
"bought_hints": string;
|
||||
"voice_over": string;
|
||||
"reached_riddles": 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.bought_hints, data.bought_hints);
|
||||
localStorage.setItem(PREF.voice_over, data.voice_over);
|
||||
localStorage.setItem(PREF.reached_riddles, data.reached_riddles);
|
||||
}
|
||||
|
||||
export async function finishSession(code: string): Promise<Response> {
|
||||
|
||||
Reference in new issue
Block a user