Loads of Riddle Stuff
This commit is contained in:
1 parent
69b730ad92
commit
eaa5cc0065
18 files changed
+393
-87
No files matched your search
@@ -16,6 +16,10 @@ const MAX_PLAYERS = 8;
|
||||
|
||||
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 [ rewatchScreen, setRewatchScreen ] = useState(false);
|
||||
const [ enterPlayerCount, setEnterPlayerCount ] = useState(false);
|
||||
const [ videoEnded, setVideoEnded ] = useState(false);
|
||||
@@ -41,7 +45,7 @@ export default function Intro() {
|
||||
|
||||
const handleChange = (event: ChangeEvent<HTMLInputElement>): boolean => {
|
||||
const value = event.target.value;
|
||||
let parsedValue = Number.parseInt(value);
|
||||
const parsedValue = Number.parseInt(value);
|
||||
|
||||
if (isNaN(parsedValue)) {
|
||||
if (value.length > 0) {
|
||||
@@ -49,12 +53,14 @@ export default function Intro() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parsedValue = Math.min(MAX_PLAYERS, Math.max(MIN_PLAYERS, parsedValue));
|
||||
//parsedValue = Math.min(MAX_PLAYERS, Math.max(MIN_PLAYERS, parsedValue));
|
||||
|
||||
setPlayerCountStr(parsedValue.toString());
|
||||
return true;
|
||||
};
|
||||
|
||||
const isPlayerCountValid = validPlayerCount(Number.parseInt(playerCountStr));
|
||||
|
||||
return (
|
||||
<div className="screen-container">
|
||||
<img src={"/bg/Hintergrund_ohne_Verzierung.webp"} style={{
|
||||
@@ -95,13 +101,28 @@ export default function Intro() {
|
||||
width: "200px",
|
||||
textAlign: "center",
|
||||
}}/>
|
||||
{ !isPlayerCountValid && !isNaN(Number.parseInt(playerCountStr)) ?
|
||||
<p style={{color: "red", fontSize: "1.1rem"}}>Die Spieleranzahl beträgt 2 bis 8 Personen.</p>
|
||||
: null }
|
||||
<br></br>
|
||||
<ChargedButton onAction={() => {
|
||||
setPlayerCount(playerCountStr);
|
||||
setRewatchScreen(true);
|
||||
}} holdDuration={500} disabled={!validPlayerCount(Number.parseInt(playerCountStr))}>
|
||||
}} holdDuration={500} disabled={!isPlayerCountValid}>
|
||||
Halten, um das Video anzusehen!
|
||||
</ChargedButton>
|
||||
<br></br>
|
||||
<ChargedButton onAction={() => {
|
||||
|
||||
}} holdDuration={2600} red={false}>
|
||||
Test
|
||||
</ChargedButton>
|
||||
<br></br>
|
||||
<ChargedButton onAction={() => {
|
||||
|
||||
}} holdDuration={2600} red={true}>
|
||||
Test
|
||||
</ChargedButton>
|
||||
</div>
|
||||
:
|
||||
<div className={styles["intro-video-container"]}>
|
||||
@@ -142,6 +163,10 @@ export default function Intro() {
|
||||
}
|
||||
}}>Video wiederholen?</ChargedButton>
|
||||
<ChargedButton holdDuration={500} onAction={() => {
|
||||
setPoints("0");
|
||||
setCompletedRiddles("");
|
||||
setPlayers("");
|
||||
setWorthyWords("");
|
||||
setStep("2");
|
||||
}}>Wir sind bereit!</ChargedButton>
|
||||
</div> : null }
|
||||
|
||||
Reference in new issue
Block a user