#184: Added clock component

This commit is contained in:
Dennis Postma 2024-11-05 20:42:52 +01:00
parent 6d7d568746
commit afb0edacf6
2 changed files with 24 additions and 2 deletions

View File

@ -0,0 +1,21 @@
<template>
<div class="absolute top-4 right-4 hidden lg:block">
<p class="text-white text-lg">{{ gameStore.world.date.toLocaleString() }}</p>
</div>
</template>
<script setup lang="ts">
import { useGameStore } from '@/stores/gameStore'
import { onUnmounted } from 'vue'
const gameStore = useGameStore()
// Listen for new date from socket
gameStore.connection?.on('date', (data: Date) => {
gameStore.world.date = new Date(data)
})
onUnmounted(() => {
gameStore.connection?.off('date')
})
</script>

View File

@ -5,7 +5,7 @@
<Menu />
<Hud />
<Hotkeys />
<Minimap />
<Clock />
<Zone />
<Chat />
<ExpBar />
@ -30,7 +30,8 @@ import Hotkeys from '@/components/gui/Hotkeys.vue'
import Chat from '@/components/gui/Chat.vue'
import CharacterProfile from '@/components/gui/CharacterProfile.vue'
import Effects from '@/components/Effects.vue'
import Minimap from '@/components/gui/Minimap.vue'
// import Minimap from '@/components/gui/Minimap.vue'
import Clock from '@/components/gui/Clock.vue'
import AwaitLoaderPlugin from 'phaser3-rex-plugins/plugins/awaitloader-plugin'
const gameStore = useGameStore()