Multiples games in parallel
release-tag / release-image (push) Successful in 58s

This commit is contained in:
2024-05-11 18:16:36 +02:00
parent 2927592ec2
commit 0c650dafc8
9 changed files with 128 additions and 50 deletions
+6 -30
View File
@@ -1,18 +1,11 @@
<script setup lang="ts">
import { ref } from "vue";
import goStore, { register, setReady, oauth2_register_discord, setup_websocket } from "@/netcode";
const config = useRuntimeConfig()
import goStore, { setReady, oauth2_register_discord, setup_websocket } from "@/netcode";
await setup_websocket()
const route = useRoute()
let username = ref<string>("legonzaur");
onMounted(async () => {
const code = route.query.code
if (!code) { return }
@@ -26,37 +19,20 @@ onMounted(async () => {
)
})
async function discordLogin() {
await navigateTo(config.public.discordLoginEndpoint, {
external: true
})
}
</script>
<template>
<div id="game_status">
<template v-if="!goStore.self">
<div v-if="goStore.game?.started">
<b>SPECTATOR MODE</b>
</div>
<template v-if="!goStore.game?.started">
<input type="text" v-model="username" />
<button @click="register(username)">LOGIN</button>
<button @click="discordLogin()">DISCORD</button>
</template>
</template>
<template v-if="goStore.self && !goStore.game?.started">
<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>
<GameBoard></GameBoard>
<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>
<style>