#327 : Fixed map load bug after closing map editor
This commit is contained in:
parent
fdbc101f96
commit
d2abf8fda8
@ -15,7 +15,7 @@ import { MapStorage } from '@/storage/storages'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { useMapStore } from '@/stores/mapStore'
|
||||
import { useScene } from 'phavuer'
|
||||
import { onUnmounted, shallowRef, watch } from 'vue'
|
||||
import { onMounted, onUnmounted, shallowRef, watch } from 'vue'
|
||||
|
||||
const scene = useScene()
|
||||
|
||||
@ -74,6 +74,11 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
if (!mapStore.mapId) return
|
||||
await initialize()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (tileMap.value) {
|
||||
tileMap.value.destroyLayer('tiles')
|
||||
@ -81,7 +86,6 @@ onUnmounted(() => {
|
||||
tileMap.value.destroy()
|
||||
}
|
||||
|
||||
mapStore.reset()
|
||||
gameStore.connection?.off('map:character:teleport')
|
||||
gameStore.connection?.off('map:character:join')
|
||||
gameStore.connection?.off('map:character:leave')
|
||||
|
Loading…
x
Reference in New Issue
Block a user