DEMO stuff and symbol renames
This commit is contained in:
1 parent
51e5a98a92
commit
45acdd3400
15 files changed
+193
-69
No files matched your search
@@ -3,7 +3,7 @@ import { PREF } from "@/utils/const"
|
||||
import ChargedButton from "../ChargedButton";
|
||||
import { usePermissions } from "@/hooks/usePermission";
|
||||
import styles from "@/css/Intro.module.css";
|
||||
import { ChangeEvent, InputEvent, MouseEvent, MouseEventHandler, PointerEvent, useRef, useState } from "react";
|
||||
import { ChangeEvent, InputEvent, MouseEvent, MouseEventHandler, PointerEvent, useMemo, useRef, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import PermissionCheck from "../PermissionCheck";
|
||||
import { PermissionStateResult } from "@/utils/permissions";
|
||||
@@ -12,23 +12,37 @@ import OldButton from "../OldButton";
|
||||
import OldTextInput from "../OldTextInput";
|
||||
import clsx from "clsx";
|
||||
import { MAX_PLAYERS, MIN_PLAYERS } from "@/utils/players";
|
||||
import { isDemoMode, setDemoMode } from "@/utils/demoMode";
|
||||
|
||||
export default function Intro() {
|
||||
const [ stepStr, setStep ] = useLocalStorage(PREF.step, "0");
|
||||
const [ , setPoints ] = useLocalStorage(PREF.points, "0");
|
||||
const [ , setCompletedRiddles ] = useLocalStorage(PREF.completed_riddles, "");
|
||||
const [ , setPlayers ] = useLocalStorage(PREF.players, "");
|
||||
const [ , setWorthyWords ] = useLocalStorage(PREF.worthyWords, "");
|
||||
const [ , setWorthyWords ] = useLocalStorage(PREF.worthy_words, "");
|
||||
const [ rewatchScreen, setRewatchScreen ] = useState(false);
|
||||
const [ enterPlayerCount, setEnterPlayerCount ] = useState(false);
|
||||
const [ videoEnded, setVideoEnded ] = useState(false);
|
||||
const [ videoPaused, setVideoPaused ] = useState(false);
|
||||
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voiceover, "off");
|
||||
const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.boughtHints, "");
|
||||
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off");
|
||||
const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, "");
|
||||
const introVideoRef = useRef<HTMLVideoElement | null>(null);
|
||||
const [ granted, setGranted ] = useState(false);
|
||||
|
||||
const [ , setPlayerCount ] = useLocalStorage(PREF.playerCount, "");
|
||||
const [ demoModeStr, ] = useLocalStorage(PREF.demo_mode, "");
|
||||
const demoMode = useMemo(() => isDemoMode(demoModeStr), [demoModeStr]);
|
||||
|
||||
const goToTheMap = () => {
|
||||
setPoints("0");
|
||||
setCompletedRiddles("");
|
||||
setBoughtHints("");
|
||||
setPlayers("");
|
||||
setWorthyWords("");
|
||||
setVoiceOverState("on");
|
||||
setStep("2");
|
||||
};
|
||||
|
||||
const [ , setPlayerCount ] = useLocalStorage(PREF.player_count, "");
|
||||
const [ playerCountStr, setPlayerCountStr] = useState("");
|
||||
|
||||
const validPlayerCount = (number: number) => {
|
||||
@@ -137,6 +151,7 @@ export default function Intro() {
|
||||
>
|
||||
<source src="/res/intro/intro.mp4" type="video/mp4"/>
|
||||
</video>
|
||||
{ demoMode ? <ChargedButton onAction={() => { goToTheMap(); }}>DEMO SKIP</ChargedButton> : null }
|
||||
{ !videoEnded && videoPaused ?
|
||||
<div className={styles["pause-screen"]}>
|
||||
<Image src="/icons/pause.svg" alt="Pause Icon" width={48} height={48}/>
|
||||
@@ -154,13 +169,7 @@ export default function Intro() {
|
||||
}
|
||||
}} whiteText={true}>Video wiederholen?</ChargedButton>
|
||||
<ChargedButton holdDuration={500} onAction={() => {
|
||||
setPoints("0");
|
||||
setCompletedRiddles("");
|
||||
setBoughtHints("");
|
||||
setPlayers("");
|
||||
setWorthyWords("");
|
||||
setVoiceOverState("on");
|
||||
setStep("2");
|
||||
goToTheMap();
|
||||
}} whiteText={true}>Wir sind bereit!</ChargedButton>
|
||||
</div> : null }
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user