diff --git a/src/lib/ImageQuestionComponent.svelte b/src/lib/ImageQuestionComponent.svelte new file mode 100644 index 0000000..df2b367 --- /dev/null +++ b/src/lib/ImageQuestionComponent.svelte @@ -0,0 +1,55 @@ + + +
Type of question unknown
{/if} diff --git a/src/routes/connected/games/[game]/+page.svelte b/src/routes/connected/games/[game]/+page.svelte index ba27b06..1ea175c 100644 --- a/src/routes/connected/games/[game]/+page.svelte +++ b/src/routes/connected/games/[game]/+page.svelte @@ -5,8 +5,8 @@ import { isMultipleChoiceQuestion, isSimpleQuestion, - type Game, - type Question + isImageQuestion, + type Game } from "$lib/games/games"; import ws from "$lib/websocket.svelte"; import { page } from "$app/state"; @@ -17,6 +17,7 @@ import PlusMinusButton from "$lib/PlusMinusButton.svelte"; import type { VisitedQuestions } from "$lib/Types.js"; import MultipleChoiceQuestionComponent from "$lib/MultipleChoiceQuestionComponent.svelte"; + import ImageQuestionComponent from "$lib/ImageQuestionComponent.svelte"; let startDisabled = $state(true); @@ -67,6 +68,7 @@ public answerIsShowing = $state(false); public questionIsShowing = $state(false); + public isBuzzed = $state(false); constructor(game: Game) { this.game = game; @@ -166,6 +168,20 @@ }); } + buzzerPressed() { + this.isBuzzed = true; + ws.sendMessage({ + type: MessageType.BUZZER_PRESSED + }); + } + + buzzerReleased() { + this.isBuzzed = false; + ws.sendMessage({ + type: MessageType.BUZZER_RELEASED + }); + } + showQuestion() { this.questionIsShowing = true; ws.sendMessage({ @@ -209,6 +225,7 @@ setupGoingBack(): void { this.answerIsShowing = false; this.questionIsShowing = false; + this.isBuzzed = false; } finishQuestion(): void { @@ -342,6 +359,13 @@ showAnswer={true} showQuestion={true} /> + {:else if isImageQuestion(gameManager.question)} +Type of question unknown
{/if} @@ -366,6 +390,15 @@ >Antwort aufdecken {/if} + {#if gameManager.isBuzzed} + + {:else} + + {/if} {#each gameManager.players as player}