feat: routes, clickable erika, kill sound
release-tag / release-image (push) Successful in 1m0s

This commit is contained in:
2024-05-12 12:03:33 +02:00
parent 4dc370de12
commit d59da50ed1
8 changed files with 115 additions and 58 deletions
+4 -16
View File
@@ -28,16 +28,9 @@ onMounted(async () => {
</script> </script>
<template> <template>
<div id="game_status"> <div class="root_dom_div">
<NuxtPage />
<template v-if="goStore.self && !goStore.current_game?.started">
<input @change="setReady(($event.target as HTMLInputElement).checked)" type="checkbox" id="ready" />
<label for="ready">Ready</label>
</template>
</div> </div>
<LoginView v-if="goStore.context === 'login'"></LoginView>
<GameBoard v-if="goStore.context != 'lobby' && goStore.context != 'login'"></GameBoard>
<LobbyView v-if="goStore.context == 'lobby'"></LobbyView>
</template> </template>
<style> <style>
@@ -55,12 +48,7 @@ body {
user-select: none; user-select: none;
} }
#game_status { .root_dom_div {
position: fixed; height: 100%;
z-index: 10;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: rgba(255, 255, 255, .75);
} }
</style> </style>
+64 -39
View File
@@ -1,16 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import goStore, { netcode_create_game, join_game } from '~/netcode'; import goStore, { netcode_create_game, join_game } from '~/netcode';
import { playSound } from '~/helpers/audioHelpers';
import { ref } from 'vue'; import { ref } from 'vue';
const erika_alive = ref(true); const erika_alive = ref(true);
const router = useRouter();
function killErika() { function killErika() {
playSound('/sounds/splat1.mp3')
erika_alive.value = false; erika_alive.value = false;
} }
</script> </script>
<template> <template>
<div class="background"> <div class="background">
<div class="title"> <div class="title">
@@ -28,16 +30,20 @@ function killErika() {
</div> </div>
<div class="overlay" v-if="erika_alive"> <div class="overlay" v-if="erika_alive">
<img class="overlay-image" src="https://static.wikia.nocookie.net/umineko/images/9/9d/PC_Erika.Casual.Sprite_36.png" alt="pétasse" /> <div class="erika-zone">
<div class="speech-bubble"> <img @click="router.push({ path: 'rules'})" class="overlay-image" src="https://static.wikia.nocookie.net/umineko/images/9/9d/PC_Erika.Casual.Sprite_36.png" alt="pétasse" />
<div class="overlay-button">
<button class="kill-erika-button" @click.stop="killErika()">Tuer Erika</button>
</div>
</div>
<div class="speech-bubble" @click.prevent.self>
<p>Ohoho!<br>Je suis Erika Furudo, la détective la plus forte du monde !</p> <p>Ohoho!<br>Je suis Erika Furudo, la détective la plus forte du monde !</p>
<p>Je vais vous montrer comment jouer à Héron Realms !</p> <p>Je vais vous montrer comment jouer à Héron Realms !</p>
<p>Cliquez moi-dessus pour afficher les <span style="color: red">règles</span>.</p> <p>Cliquez moi-dessus pour afficher les <span style="color: red">règles</span>.</p>
<p>Ou sinon, commencez direct en créant une partie ou rejoingnant une partie existante.</p> <p>Ou sinon, commencez direct en créant une partie ou rejoingnant une partie existante.</p>
</div> </div>
<div class="overlay-button">
<button class="kill-erika-button" @click="killErika()">Tuer Erika</button>
</div>
</div> </div>
@@ -126,13 +132,59 @@ function killErika() {
} }
} }
.overlay-image { .overlay {
height: 100%;
width: 100%;
position: absolute;
pointer-events: none;
}
.erika-zone {
position: absolute; position: absolute;
top: 60%; top: 60%;
right: 20px; display: flex;
z-index: 1; justify-content: right;
z-index: 2;
height: 40%; height: 40%;
width: 100%;
object-fit: cover; object-fit: cover;
.overlay-image {
position: absolute;
height: 100%;
cursor: pointer;
pointer-events: all;
}
.overlay-button {
position: absolute;
z-index: 1;
width: 300px;
height: 300px;
padding-top: 200px;
box-sizing: border-box;
pointer-events: none;
.kill-erika-button {
display: none;
pointer-events: all;
background-color: #f44336;
border: none;
color: white;
text-align: center;
text-decoration: none;
font-family: 'Roboto', sans-serif;
font-size: 16px;
margin: auto;
cursor: pointer;
border-radius: 12px;
padding: 10px 24px;
height: 50px;
transition-duration: 0.4s;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
}
} }
.speech-bubble { .speech-bubble {
@@ -152,38 +204,11 @@ function killErika() {
line-height: 1.5; line-height: 1.5;
} }
.overlay-button { .erika-zone:hover {
position: absolute; .overlay-button {
top: 49%;
right: 20px;
z-index: 1;
width: 300px;
height: 300px;
padding-top: 50px;
.kill-erika-button {
display: none;
background-color: #f44336;
border: none;
color: white;
text-align: center;
text-decoration: none;
font-family: 'Roboto', sans-serif;
font-size: 16px;
margin: auto;
cursor: pointer;
border-radius: 12px;
padding: 10px 24px;
height: 50px;
transition-duration: 0.4s;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
}
.overlay-button:hover {
.kill-erika-button { .kill-erika-button {
display: inline-block; display: inline-block;
} }
}
} }
</style> </style>
+4
View File
@@ -0,0 +1,4 @@
export function playSound(soundUrl: string): void {
const audio = new Audio(soundUrl);
audio.play();
}
+1 -1
View File
@@ -25,7 +25,7 @@ export class GameObjectRegister {
readonly turns: Map<string, Turn>; readonly turns: Map<string, Turn>;
readonly games: Map<string, Game> readonly games: Map<string, Game>
context: "lobby" | "login" | "pregame" | "game" = "login"; context: "lobby" | "login" | "pregame" | "game" | "rules" = "login";
private readonly objects: Map<string, GameObjectNetcode>; private readonly objects: Map<string, GameObjectNetcode>;
current_game: Ref<Game | null> current_game: Ref<Game | null>
lobby: Ref<Lobby | null>; lobby: Ref<Lobby | null>;
+37
View File
@@ -0,0 +1,37 @@
<script setup lang="ts">
import goStore, { setReady } from "@/netcode";
</script>
<template>
<div class="root_page_div">
<div id="game_status">
<template v-if="goStore.self && !goStore.current_game?.started">
<input @change="setReady(($event.target as HTMLInputElement).checked)" type="checkbox" id="ready" />
<label for="ready">Ready</label>
</template>
</div>
<LoginView v-if="goStore.context === 'login'"></LoginView>
<GameBoard v-if="goStore.context != 'lobby' && goStore.context != 'login'"></GameBoard>
<LobbyView v-if="goStore.context == 'lobby'"></LobbyView>
<RulesDisplay v-if="goStore.context == 'rules'"></RulesDisplay>
</div>
</template>
<style>
.root_page_div {
height: 100%;
}
#game_status {
position: fixed;
z-index: 10;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: rgba(255, 255, 255, .75);
}
</style>
+3
View File
@@ -0,0 +1,3 @@
<template>
<RulesDisplay></RulesDisplay>
</template>
Binary file not shown.
Binary file not shown.