Major refractor, cleaning and improvements.

This commit is contained in:
2024-08-24 03:07:48 +02:00
parent 6c44821ebb
commit bdc2ba35c9
33 changed files with 188 additions and 298 deletions

View File

@ -5,14 +5,14 @@
<Inventory />
<div v-if="!zoneEditorStore.active">
<Game :config="gameConfig" @create="createGame">
<Game :config="gameConfig" @create="createGame" class="111mt-[-60px]">
<Scene name="main" @preload="preloadScene" @create="createScene">
<div class="fixed inset-x-0 top-0 flex justify-start items-end p-10 pointer-events-none">
<div class="pointer-events-auto">
<Hud />
</div>
</div>
<Zone v-if="isLoaded" :key="zoneStore.zone?.id ?? 0" />
<Zone v-if="isLoaded" />
<div class="fixed inset-x-0 bottom-0 flex justify-between gap-5 items-end py-10 px-5 xxs:p-10 pointer-events-none max-md:flex-wrap max-md:flex-col-reverse">
<div class="pointer-events-auto w-full">
<Chat />
@ -37,24 +37,22 @@
<script setup lang="ts">
import config from '@/config'
import 'phaser'
import { watch, ref, onBeforeUnmount, onBeforeMount } from 'vue'
import { watch, ref, onBeforeUnmount } from 'vue'
import { storeToRefs } from 'pinia'
import { Game, Scene } from 'phavuer'
import { useGameStore } from '@/stores/game'
import { useZoneEditorStore } from '@/stores/zoneEditor'
import { useAssetStore } from '@/stores/assets'
import { useZoneStore } from '@/stores/zone'
import Hud from '@/components/gui/Hud.vue'
import Zone from '@/components/Zone.vue'
import Zone from '@/components/zone/Zone.vue'
import Chat from '@/components/gui/Chat.vue'
import Menubar from '@/components/gui/Menu.vue'
import GmTools from '@/components/utilities/GmTools.vue'
import ZoneEditor from '@/components/utilities/zoneEditor/ZoneEditor.vue'
import GmPanel from '@/components/utilities/GmPanel.vue'
import Inventory from '@/components/utilities/inventory/Inventory.vue'
import GmTools from '@/components/gameMaster/GmTools.vue'
import ZoneEditor from '@/components/gameMaster/zoneEditor/ZoneEditor.vue'
import GmPanel from '@/components/gameMaster/GmPanel.vue'
import Inventory from '@/components/gui/Inventory.vue'
const gameStore = useGameStore()
const zoneStore = useZoneStore()
const zoneEditorStore = useZoneEditorStore()
const assetStore = useAssetStore()
const isLoaded = ref(false)
@ -163,14 +161,6 @@ const createScene = (scene: Phaser.Scene) => {
})
}
gameStore.connection?.on('disconnect', () => {
game.scale.resize(window.innerWidth, window.innerHeight)
})
onBeforeMount(() => {
gameStore.connection?.emit('character:zone:request', { zoneId: gameStore.character?.zoneId })
})
onBeforeUnmount(() => {
gameStore.disconnectSocket()
})