Refractor socket store into game store

This commit is contained in:
2024-07-12 11:58:06 +02:00
parent 6a1b2dd107
commit 79bef033f3
22 changed files with 161 additions and 170 deletions

View File

@ -31,7 +31,7 @@ import 'phaser'
import { onUnmounted, toRaw, watch, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { Game, Scene } from 'phavuer'
import { useSocketStore } from '@/stores/socket'
import { useGameStore } from '@/stores/game'
import { useZoneEditorStore } from '@/stores/zoneEditor'
import { useAssetStore } from '@/stores/assets'
import World from '@/components/World.vue'
@ -42,19 +42,19 @@ import GmTools from '@/components/utilities/GmTools.vue'
import ZoneEditor from '@/components/utilities/zoneEditor/ZoneEditor.vue'
import GmPanel from '@/components/utilities/GmPanel.vue'
const socket = useSocketStore()
const gameStore = useGameStore()
const zoneEditorStore = useZoneEditorStore()
const assetStore = useAssetStore()
const isLoaded = ref(false)
const { assets } = storeToRefs(assetStore)
onUnmounted(() => {
socket.disconnectSocket()
gameStore.disconnectSocket()
})
// On page close
addEventListener('beforeunload', () => {
socket.disconnectSocket()
gameStore.disconnectSocket()
})
const gameConfig = {