Compare commits
4 Commits
0.16.2
...
dfae8ebb5d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfae8ebb5d | ||
|
|
9888fb7143 | ||
|
|
66a55e4287 | ||
|
|
8dddf2eaf2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,4 +34,3 @@ coverage
|
|||||||
|
|
||||||
# Vitest
|
# Vitest
|
||||||
__screenshots__/
|
__screenshots__/
|
||||||
/dev-dist/
|
|
||||||
|
|||||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -115,18 +115,3 @@
|
|||||||
|
|
||||||
* **ui:** FRO-34 Lobby ([#21](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/21)) ([bb6355d](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/bb6355d9ed6745b4852a52040d880ee1dcc6d797))
|
* **ui:** FRO-34 Lobby ([#21](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/21)) ([bb6355d](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/bb6355d9ed6745b4852a52040d880ee1dcc6d797))
|
||||||
* **ui:** FRO-5 Animation Card Played ([#23](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/23)) ([70a44fd](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/70a44fd1ea119d43f875e6cfac56fb25747d8913))
|
* **ui:** FRO-5 Animation Card Played ([#23](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/23)) ([70a44fd](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/70a44fd1ea119d43f875e6cfac56fb25747d8913))
|
||||||
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.14.0...0.0.0) (2026-01-06)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Enhance win effects and animations in OfflineView component ([db5c70d](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/db5c70d02a646b83ba6e4043e28fc0dc9f76fb04))
|
|
||||||
* Enhance win effects and animations in OfflineView component ([8aa0738](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/8aa07388ac27fbb13270fde58b1594688ec44fe7))
|
|
||||||
* Enhance win effects and animations in OfflineView component ([6b3eaf2](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/6b3eaf2c706b2ea479aa7ba508b05adb4bab2db4))
|
|
||||||
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.15.0...0.0.0) (2026-01-06)
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Update Dockerfile for multi-platform support and add nginx configuration ([e972f1c](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/e972f1c4321ec2633e2989dbdaa714774632c495))
|
|
||||||
* Update Dockerfile for multi-platform support and add nginx configuration ([37b88a1](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/37b88a108c71e20fc2caee950acd23cf2bb81190))
|
|
||||||
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.16.0...0.0.0) (2026-01-06)
|
|
||||||
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.16.1...0.0.0) (2026-01-07)
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM --platform=$BUILDPLATFORM node:lts-alpine3.23 AS builder
|
FROM node:lts-alpine3.23 AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -9,15 +9,13 @@ RUN npm install
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM --platform=$TARGETPLATFORM nginx:stable-alpine AS production
|
FROM nginx:stable-alpine AS production
|
||||||
|
|
||||||
RUN apk add --no-cache gettext
|
RUN apk add --no-cache gettext
|
||||||
|
|
||||||
RUN rm -rf /usr/share/nginx/html/*
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
COPY public/env.template.js /usr/share/nginx/html/env.template.js
|
COPY public/env.template.js /usr/share/nginx/html/env.template.js
|
||||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
RUN chmod +x /docker-entrypoint.sh
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ TARGET_PATH="/usr/share/nginx/html/env.js"
|
|||||||
|
|
||||||
if [ -f "$TEMPLATE_PATH" ]; then
|
if [ -f "$TEMPLATE_PATH" ]; then
|
||||||
echo "Rendering runtime config from $TEMPLATE_PATH"
|
echo "Rendering runtime config from $TEMPLATE_PATH"
|
||||||
echo "Using environment variables:"
|
# export all variables for envsubst to access
|
||||||
printenv
|
# only substitute variables present in the template
|
||||||
echo "----"
|
|
||||||
envsubst < "$TEMPLATE_PATH" > "$TARGET_PATH"
|
envsubst < "$TEMPLATE_PATH" > "$TARGET_PATH"
|
||||||
else
|
else
|
||||||
echo "No runtime template found at $TEMPLATE_PATH, skipping"
|
echo "No runtime template found at $TEMPLATE_PATH, skipping"
|
||||||
|
|||||||
15
nginx.conf
15
nginx.conf
@@ -1,15 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
window.__RUNTIME_CONFIG__ = {
|
window.__RUNTIME_CONFIG__ = {
|
||||||
API_URL: "http://localhost:9000",
|
API_URL: "http://localhost:9000",
|
||||||
WEBSOCKET_URL: "ws://localhost:9000/websocket"
|
WEBSOCKET_API_URL: "ws://localhost:9000/websocket"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
window.__RUNTIME_CONFIG__ = {
|
window.__RUNTIME_CONFIG__ = {
|
||||||
API_URL: "${API_URL}",
|
API_URL: "${API_URL}",
|
||||||
WEBSOCKET_URL: "${WEBSOCKET_URL}"
|
WEBSOCKET_API_URL: "${WEBSOCKET_API_URL}"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
import {useIngame} from "@/composables/useIngame.ts";
|
||||||
import type {GameInfo, TrumpInfo} from "@/types/GameTypes.ts";
|
import type {GameInfo} from "@/types/GameTypes.ts";
|
||||||
import HandC from "@/components/ingame/HandC.vue";
|
import HandC from "@/components/ingame/HandC.vue";
|
||||||
import GameInfoC from "@/components/ingame/GameInfoC.vue";
|
import GameInfoC from "@/components/ingame/GameInfoC.vue";
|
||||||
import PlayedCardsC from "@/components/ingame/PlayedCardsC.vue";
|
import PlayedCardsC from "@/components/ingame/PlayedCardsC.vue";
|
||||||
import ScoreboardC from "@/components/ingame/ScoreboardC.vue";
|
import ScoreboardC from "@/components/ingame/ScoreboardC.vue";
|
||||||
import TurnC from "@/components/ingame/TurnC.vue";
|
import TurnC from "@/components/ingame/TurnC.vue";
|
||||||
import TrumpC from "@/components/ingame/TrumpC.vue";
|
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
import {ref, toRefs, watch} from "vue";
|
|
||||||
|
|
||||||
const ig = useIngame()
|
const ig = useIngame()
|
||||||
const { state } = toRefs(ig)
|
|
||||||
|
|
||||||
const cachedGameInfo = ref<GameInfo | null>(null)
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => ig.data,
|
|
||||||
(newData) => {
|
|
||||||
if (state.value === 'InGame' && newData) {
|
|
||||||
cachedGameInfo.value = newData as GameInfo
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ deep: true, immediate: true }
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -32,46 +17,34 @@ watch(
|
|||||||
<q-page-container>
|
<q-page-container>
|
||||||
<q-page class="game-field-background vh-100 ingame-side-shadow">
|
<q-page class="game-field-background vh-100 ingame-side-shadow">
|
||||||
<div class="py-5 container-xxl">
|
<div class="py-5 container-xxl">
|
||||||
<transition
|
|
||||||
appear
|
|
||||||
enter-active-class="animate__animated animate__fadeInDown"
|
|
||||||
leave-active-class="animate__animated animate__fadeOutDown"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
v-if="state === 'SelectTrump'"
|
|
||||||
class="full-overlay-blur"
|
|
||||||
style="z-index: 2000;"
|
|
||||||
>
|
|
||||||
<TrumpC />
|
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
<div class="fit row wrap justify-center items-center content-start">
|
<div class="fit row wrap justify-center items-center content-start">
|
||||||
<div class="mt-5 ml-4 self-start col-2">
|
<div class="mt-5 ml-4 self-start col-2">
|
||||||
<TurnC v-if="(cachedGameInfo as GameInfo)?.playerQueue" :queue="(cachedGameInfo as GameInfo).playerQueue!"/>
|
<TurnC v-if="(ig.data as GameInfo)?.playerQueue" :queue="(ig.data as GameInfo).playerQueue!"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center col-6">
|
<div class="text-center col-6">
|
||||||
<ScoreboardC v-if="(cachedGameInfo as GameInfo)?.currentRound" :current-round="(cachedGameInfo as GameInfo).currentRound!" />
|
<ScoreboardC v-if="(ig.data as GameInfo)?.currentRound" :current-round="(ig.data as GameInfo).currentRound!" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="mt-5 ml-4 self-end col-2" style="margin-left: 6em">
|
<div class="mt-5 ml-4 self-end col-2" style="margin-left: 6em">
|
||||||
<GameInfoC v-if="(cachedGameInfo as GameInfo)?.currentRound"
|
<GameInfoC v-if="(ig.data as GameInfo)?.currentRound"
|
||||||
:first-card="(cachedGameInfo as GameInfo).currentTrick?.firstCard ?? null"
|
:first-card="(ig.data as GameInfo).currentTrick?.firstCard ?? null"
|
||||||
:trumpsuit="(cachedGameInfo as GameInfo).currentRound!.trumpSuit"/>
|
:trumpsuit="(ig.data as GameInfo).currentRound!.trumpSuit"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="fit row wrap justify-center items-center content-start">
|
<div class="fit row wrap justify-center items-center content-start">
|
||||||
<div class="mt-4 ml-4 col-3 justify-content-center">
|
<div class="mt-4 ml-4 col-3 justify-content-center">
|
||||||
<div class="d-flex justify-content-center g-3 mb-5">
|
<div class="d-flex justify-content-center g-3 mb-5">
|
||||||
<PlayedCardsC v-if="(cachedGameInfo as GameInfo)?.currentTrick" :trick="(cachedGameInfo as GameInfo).currentTrick!" />
|
<PlayedCardsC v-if="(ig.data as GameInfo)?.currentTrick" :trick="(ig.data as GameInfo).currentTrick!" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="q-gutter-sm mt-4 bottom-div justify-content-center row" style="backdrop-filter: blur(4px); margin-left: 0; margin-right: 0;">
|
<div class="q-gutter-sm mt-4 bottom-div justify-content-center row" style="backdrop-filter: blur(4px); margin-left: 0; margin-right: 0;">
|
||||||
<div class="flex justify-center col-12">
|
<div class="flex justify-center col-12">
|
||||||
<HandC v-if="(cachedGameInfo as GameInfo)?.hand && (cachedGameInfo as GameInfo)?.self"/>
|
<HandC v-if="(ig.data as GameInfo)?.hand && (ig.data as GameInfo)?.self"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -104,17 +77,4 @@ watch(
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.full-overlay-blur {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
backdrop-filter: blur(5px);
|
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
<script setup lang="ts" >
|
|
||||||
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
|
||||||
import type {GameInfo, TrumpInfo} from "@/types/GameTypes.ts";
|
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
const wb = useWebSocket()
|
|
||||||
const wi = useIngame()
|
|
||||||
const trumpInf = wi.data as TrumpInfo
|
|
||||||
const trumpSuits = [
|
|
||||||
"/images/cards/AS.png",
|
|
||||||
"/images/cards/AH.png",
|
|
||||||
"/images/cards/AD.png",
|
|
||||||
"/images/cards/AC.png"
|
|
||||||
]
|
|
||||||
const $q = useQuasar();
|
|
||||||
function getCardImagePath(cardPath: string) {
|
|
||||||
if (!cardPath) return ''
|
|
||||||
if (cardPath.includes('://') || cardPath.startsWith('/')) return cardPath
|
|
||||||
return `/${cardPath}`
|
|
||||||
}
|
|
||||||
function selectTrump(trumpSuitIndex: number) {
|
|
||||||
wb.sendAndWait("PickTrumpsuit", { suitIndex: trumpSuitIndex }).then(
|
|
||||||
$q.notify({
|
|
||||||
message: "You've successfully picked your trumpsuit",
|
|
||||||
color: "positive",
|
|
||||||
position: "top"
|
|
||||||
})
|
|
||||||
|
|
||||||
).catch((error) => {
|
|
||||||
$q.notify({
|
|
||||||
message: error.message,
|
|
||||||
color: "negative",
|
|
||||||
position: "top"
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<q-card v-if="trumpInf.chooser?.name === trumpInf.self?.name" class="player-profile-card" flat bordered>
|
|
||||||
<q-card-section class="bg-white text-dark text-center q-py-lg">
|
|
||||||
<div class="text-h3 text-weight-bolder">
|
|
||||||
{{ trumpInf.self?.name || "Loading Player..."}}
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-card-section class="bg-light-green-7 text-dark text-center q-py-lg">
|
|
||||||
<div class="text-h4 text-weight-bolder">
|
|
||||||
<q-icon name="emoji_events" class="q-mr-sm" />
|
|
||||||
You won the last round!
|
|
||||||
<q-icon name="emoji_events" class="q-mr-sm" />
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-card-section class="q-py-md text-center bg-dark">
|
|
||||||
<div class="text-h6 q-mb-sm">Select a trumpsuit</div>
|
|
||||||
<div class="row justify-center q-gutter-sm">
|
|
||||||
<q-card v-for="(path, index) in trumpSuits" :key="index" class="q-pa-xs cursor-pointer trump-card-choice">
|
|
||||||
<q-img
|
|
||||||
:src="getCardImagePath(path)"
|
|
||||||
@click="selectTrump(index)"
|
|
||||||
:alt="path"
|
|
||||||
class="card"
|
|
||||||
/>
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator color="grey-7" style="opacity: 0.9;" />
|
|
||||||
|
|
||||||
<q-card-section class="q-pa-md text-center bg-dark">
|
|
||||||
<div class="text-h6 q-mb-sm">Your Hand ({{ trumpInf.selfHand?.cards.length || 0 }} Cards)</div>
|
|
||||||
<div class="row wrap justify-center q-gutter-sm">
|
|
||||||
|
|
||||||
<div v-for="card in trumpInf.selfHand?.cards || []" :key="card.idx!" >
|
|
||||||
<q-img
|
|
||||||
:src="getCardImagePath(card.path)"
|
|
||||||
:alt="card.identifier"
|
|
||||||
class="card"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
</q-card>
|
|
||||||
<q-card
|
|
||||||
v-else
|
|
||||||
class="player-profile-card text-center"
|
|
||||||
flat
|
|
||||||
bordered
|
|
||||||
style="min-height: 200px; display: flex; flex-direction: column; justify-content: center;"
|
|
||||||
>
|
|
||||||
<q-card-section class="q-pa-lg">
|
|
||||||
<q-spinner-hourglass color="black" size="3em" class="q-mb-md" />
|
|
||||||
<div class="text-h5 text-grey-8">
|
|
||||||
Waiting for {{ trumpInf.chooser?.name || 'the other player' }} to select the trump suit...
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
|
||||||
<q-card-section class="q-pa-md text-center bg-dark">
|
|
||||||
<div class="text-h6 text-white q-mb-sm">Your Hand ({{ trumpInf.selfHand?.cards.length || 0 }} Cards)</div>
|
|
||||||
<div class="row wrap justify-center q-gutter-sm">
|
|
||||||
|
|
||||||
<div v-for="card in trumpInf.selfHand?.cards || []" :key="card.idx!" >
|
|
||||||
<q-img
|
|
||||||
:src="getCardImagePath(card.path)"
|
|
||||||
:alt="card.identifier"
|
|
||||||
class="card"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
</q-card>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.card {
|
|
||||||
width:120px;
|
|
||||||
border-radius:6px
|
|
||||||
}
|
|
||||||
.player-profile-card {
|
|
||||||
max-width: 1000px;
|
|
||||||
}
|
|
||||||
.trump-card-choice {
|
|
||||||
transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
|
|
||||||
}
|
|
||||||
.trump-card-choice:hover {
|
|
||||||
transform: translateY(-8px);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -5,8 +5,8 @@ import {useIngame} from "@/composables/useIngame.ts";
|
|||||||
import type {GameInfo} from "@/types/GameTypes.ts";
|
import type {GameInfo} from "@/types/GameTypes.ts";
|
||||||
|
|
||||||
const ig = useIngame()
|
const ig = useIngame()
|
||||||
const currentPlayer = computed(() => (<GameInfo>ig.data).playerQueue?.currentPlayer)
|
const currentPlayer = computed(() => (<GameInfo>ig.data).playerQueue.currentPlayer)
|
||||||
const queue = computed(() => { return (<GameInfo>ig.data).playerQueue?.queue ?? []})
|
const queue = computed(() => { return (<GameInfo>ig.data).playerQueue.queue ?? []})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -172,9 +172,6 @@ function setupSocketHandlers(socket: WebSocket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function connectWebSocket(url?: string): Promise<void> {
|
export function connectWebSocket(url?: string): Promise<void> {
|
||||||
if (!url) {
|
|
||||||
url = window.__RUNTIME_CONFIG__?.WEBSOCKET_URL
|
|
||||||
}
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
const loc = window.location;
|
const loc = window.location;
|
||||||
const protocol = loc.protocol === "https:" ? "wss:" : "ws:";
|
const protocol = loc.protocol === "https:" ? "wss:" : "ws:";
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ ui.requestState().then(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="lobby-background">
|
<div class="lobby-background">
|
||||||
<Ingame v-if="state === 'InGame' || state === 'SelectTrump'"/>
|
<Ingame v-if="state === 'InGame'"/>
|
||||||
<lobby-component v-if="state === 'Lobby'"/>
|
<lobby-component v-if="state === 'Lobby'"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ const reelStates = ref([
|
|||||||
|
|
||||||
const globalSpinning = ref(false)
|
const globalSpinning = ref(false)
|
||||||
const hasSpun = ref(false)
|
const hasSpun = ref(false)
|
||||||
const glowThird = ref(false)
|
|
||||||
const winBlink = ref(false)
|
|
||||||
const winFire = ref(false)
|
|
||||||
let winEffectsTimer: number | undefined
|
|
||||||
|
|
||||||
const isWinner = computed(() => {
|
const isWinner = computed(() => {
|
||||||
const [r1, r2, r3] = reelStates.value;
|
const [r1, r2, r3] = reelStates.value;
|
||||||
@@ -30,56 +26,21 @@ const spin = (): void => {
|
|||||||
|
|
||||||
globalSpinning.value = true;
|
globalSpinning.value = true;
|
||||||
hasSpun.value = false;
|
hasSpun.value = false;
|
||||||
// Reset possible win effects
|
|
||||||
winBlink.value = false;
|
reelStates.value.forEach((reel, index) => {
|
||||||
winFire.value = false;
|
|
||||||
if (winEffectsTimer) {
|
|
||||||
clearTimeout(winEffectsTimer);
|
|
||||||
winEffectsTimer = undefined;
|
|
||||||
}
|
|
||||||
reelStates.value.forEach((reel) => {
|
|
||||||
reel.isSpinning = true;
|
reel.isSpinning = true;
|
||||||
reel.value = getRandomSymbol();
|
|
||||||
});
|
|
||||||
|
|
||||||
const base0 = 1500;
|
|
||||||
const gap = 800;
|
|
||||||
const base1 = base0 + gap;
|
|
||||||
const base2 = base1 + gap;
|
|
||||||
setTimeout(() => {
|
|
||||||
reelStates.value[0]!!.isSpinning = false;
|
|
||||||
}, base0);
|
|
||||||
setTimeout(() => {
|
|
||||||
reelStates.value[1]!!.isSpinning = false;
|
|
||||||
}, base1);
|
|
||||||
setTimeout(() => {
|
|
||||||
const firstTwoMatch = reelStates.value[0]!!.value === reelStates!!.value[1]!!.value &&
|
|
||||||
reelStates.value[0]!!.value !== '❓';
|
|
||||||
const extraDelay = firstTwoMatch ? 1000 : 0;
|
|
||||||
|
|
||||||
glowThird.value = firstTwoMatch;
|
|
||||||
|
|
||||||
|
// Stop each reel with a stagger
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reelStates.value[2]!!.isSpinning = false;
|
reel.value = getRandomSymbol();
|
||||||
glowThird.value = false;
|
reel.isSpinning = false;
|
||||||
globalSpinning.value = false;
|
|
||||||
hasSpun.value = true;
|
|
||||||
|
|
||||||
const allThreeMatch =
|
if (index === 2) {
|
||||||
reelStates.value[0]!!.value !== '❓' &&
|
globalSpinning.value = false;
|
||||||
reelStates.value[0]!!.value === reelStates.value[1]!!.value &&
|
hasSpun.value = true;
|
||||||
reelStates.value[1]!!.value === reelStates.value[2]!!.value;
|
|
||||||
if (allThreeMatch) {
|
|
||||||
winFire.value = true;
|
|
||||||
winBlink.value = true;
|
|
||||||
winEffectsTimer = window.setTimeout(() => {
|
|
||||||
winFire.value = false;
|
|
||||||
winBlink.value = false;
|
|
||||||
winEffectsTimer = undefined;
|
|
||||||
}, 3000);
|
|
||||||
}
|
}
|
||||||
}, base2 - base1 + extraDelay);
|
}, 1500 + (index * 800));
|
||||||
}, base1);
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -94,20 +55,16 @@ const spin = (): void => {
|
|||||||
leave-active-class="animate__animated animate__fadeOutUp"
|
leave-active-class="animate__animated animate__fadeOutUp"
|
||||||
>
|
>
|
||||||
<q-card class="slot-machine-card q-pa-lg text-center shadow-10">
|
<q-card class="slot-machine-card q-pa-lg text-center shadow-10">
|
||||||
<div class="text-h4 q-mb-md text-black text-weight-bolder " style="font-family: serif;">Offline Drehmaschine</div>
|
<div class="text-h4 q-mb-md text-black text-weight-bolder " style="font-family: serif;">Offline Casino</div>
|
||||||
|
|
||||||
<div class="row justify-center q-gutter-md q-mb-xl">
|
<div class="row justify-center q-gutter-md q-mb-xl">
|
||||||
<div
|
<div v-for="(reel, index) in reelStates" :key="index" class="reel-container shadow-2">
|
||||||
v-for="(reel, index) in reelStates"
|
|
||||||
:key="index"
|
|
||||||
:class="['reel-container', 'shadow-2', (winFire || (glowThird && index === 2)) ? 'glow-fire' : '']"
|
|
||||||
>
|
|
||||||
|
|
||||||
<div v-if="reel.isSpinning" class="reel-strip">
|
<div v-if="reel.isSpinning" class="reel-strip">
|
||||||
<div v-for="n in 10" :key="n" class="text-h2">{{ symbols[n % symbols.length] }}</div>
|
<div v-for="n in 10" :key="n" class="text-h2">{{ symbols[n % symbols.length] }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else :class="['text-h2', 'static-symbol', winBlink ? 'blink-win' : '']">{{ reel.value }}</div>
|
<div v-else class="text-h2 static-symbol">{{ reel.value }}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -173,40 +130,4 @@ const spin = (): void => {
|
|||||||
|
|
||||||
.animate-bounce { animation: bounce 0.5s infinite alternate; }
|
.animate-bounce { animation: bounce 0.5s infinite alternate; }
|
||||||
@keyframes bounce { from { transform: scale(1); } to { transform: scale(1.1); } }
|
@keyframes bounce { from { transform: scale(1); } to { transform: scale(1.1); } }
|
||||||
|
|
||||||
.glow-fire {
|
|
||||||
border-color: #ff9800;
|
|
||||||
box-shadow:
|
|
||||||
0 0 10px 2px rgba(255, 152, 0, 0.8),
|
|
||||||
0 0 18px 6px rgba(255, 87, 34, 0.5),
|
|
||||||
inset 0 0 8px 2px rgba(255, 193, 7, 0.4);
|
|
||||||
animation: fireGlow 900ms ease-in-out infinite alternate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fireGlow {
|
|
||||||
0% {
|
|
||||||
box-shadow:
|
|
||||||
0 0 6px 1px rgba(255, 152, 0, 0.6),
|
|
||||||
0 0 12px 3px rgba(255, 87, 34, 0.35),
|
|
||||||
inset 0 0 5px 1px rgba(255, 193, 7, 0.3);
|
|
||||||
transform: translateY(0) scale(1);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
box-shadow:
|
|
||||||
0 0 14px 3px rgba(255, 152, 0, 1),
|
|
||||||
0 0 24px 8px rgba(255, 87, 34, 0.6),
|
|
||||||
inset 0 0 10px 3px rgba(255, 193, 7, 0.5);
|
|
||||||
transform: translateY(-1px) scale(1.02);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.blink-win {
|
|
||||||
animation: blinkWin 300ms steps(1, end) infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes blinkWin {
|
|
||||||
0% { opacity: 1; filter: drop-shadow(0 0 0 rgba(255,255,255,0)); }
|
|
||||||
50% { opacity: 0.2; filter: drop-shadow(0 0 6px rgba(255,255,255,0.6)); }
|
|
||||||
100% { opacity: 1; filter: drop-shadow(0 0 0 rgba(255,255,255,0)); }
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=16
|
MINOR=14
|
||||||
PATCH=2
|
PATCH=0
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
|
|||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
|
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
|
||||||
|
|
||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
@@ -17,11 +18,18 @@ export default defineConfig({
|
|||||||
quasar(),
|
quasar(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
registerType: 'autoUpdate',
|
registerType: 'autoUpdate',
|
||||||
|
injectRegister: 'auto',
|
||||||
|
|
||||||
workbox: {
|
workbox: {
|
||||||
globDirectory: 'dist/',
|
globDirectory: 'dist/',
|
||||||
globPatterns: [
|
globPatterns: [
|
||||||
'**/*.{js,css,html,ico,png,svg,webmanifest}',
|
'**/*.{js,css,html,ico,png,svg,webmanifest}',
|
||||||
],
|
],
|
||||||
|
globIgnores: [
|
||||||
|
'**/node_modules/**/*',
|
||||||
|
'sw.js',
|
||||||
|
],
|
||||||
|
swDest: 'dist/sw.js',
|
||||||
},
|
},
|
||||||
|
|
||||||
manifest: {
|
manifest: {
|
||||||
|
|||||||
Reference in New Issue
Block a user