1
0
forked from noxious/client

Loading world works

This commit is contained in:
2024-07-12 12:44:37 +02:00
parent 79bef033f3
commit 0fcd5c4d76
20 changed files with 228 additions and 177 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="flex justify-center items-center h-dvh p-[30px] relative">
<GmTools v-if="isLoaded" />
<GmPanel v-if="isLoaded" />
<GmTools v-if="isLoaded && gameStore.character?.role === 'gm'" />
<GmPanel v-if="isLoaded && gameStore.character?.role === 'gm'" />
<Game :config="gameConfig" @create="createGame" v-if="!zoneEditorStore.active">
<Scene name="main" @preload="preloadScene" @create="createScene">
@ -9,7 +9,7 @@
<Hud />
</div>
<div v-if="isLoaded">
<World />
<World :key="gameStore.character?.zoneId ?? 1" />
</div>
<div class="flex absolute justify-between left-0 right-0 bottom-[100px] h-[100px] mx-[48px] my-0" v-if="isLoaded">
<Chat />
@ -28,10 +28,11 @@
<script setup lang="ts">
import config from '@/config'
import 'phaser'
import { onUnmounted, toRaw, watch, ref } from 'vue'
import { onUnmounted, watch, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { Game, Scene } from 'phavuer'
import { useGameStore } from '@/stores/game'
import { useZoneStore } from '@/stores/zone'
import { useZoneEditorStore } from '@/stores/zoneEditor'
import { useAssetStore } from '@/stores/assets'
import World from '@/components/World.vue'
@ -43,6 +44,7 @@ import ZoneEditor from '@/components/utilities/zoneEditor/ZoneEditor.vue'
import GmPanel from '@/components/utilities/GmPanel.vue'
const gameStore = useGameStore()
const zoneStore = useZoneStore()
const zoneEditorStore = useZoneEditorStore()
const assetStore = useAssetStore()
const isLoaded = ref(false)

View File

@ -52,7 +52,7 @@ onMounted(async () => {
/**
* Fetch assets from the server
*/
if (!await assetStore.fetchAssets()) {
if (!(await assetStore.fetchAssets())) {
notifications.addNotification({ message: 'Failed to fetch assets, the server may be offline or in maintenance. Please try again later.' })
}
})