Refractor socket store into game store
This commit is contained in:
@ -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 = {
|
||||
|
Reference in New Issue
Block a user