#184: Added clock component
This commit is contained in:
parent
6d7d568746
commit
afb0edacf6
21
src/components/gui/Clock.vue
Normal file
21
src/components/gui/Clock.vue
Normal 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>
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user