1
0
forked from noxious/client

Showing placed map object works in both game and map editor, updated types, cleaned some logic

This commit is contained in:
2025-02-05 02:27:18 +01:00
parent 027fdd7dac
commit d2b6d8dcb3
12 changed files with 134 additions and 112 deletions

View File

@ -3,7 +3,6 @@
</template>
<script setup lang="ts">
import type { UUID } from '@/application/types'
import Controls from '@/components/utilities/Controls.vue'
import { loadTileTexturesFromMapTileArray, placeTiles } from '@/services/mapService'
import { MapStorage } from '@/storage/storages'
@ -20,19 +19,14 @@ const props = defineProps<{
tileMapLayer: Phaser.Tilemaps.TilemapLayer
}>()
loadTileTexturesFromMapTileArray(mapStore.mapId as UUID, scene)
.then(() => mapStorage.get(mapStore.mapId))
.then((mapData) => {
if (!mapData || !mapData?.tiles) return
})
.catch((error) => console.error('Failed to initialize map:', error))
onMounted(async () => {
if (!mapStore.mapId) return
const map = await mapStorage.get(mapStore.mapId)
if (!map) return
await loadTileTexturesFromMapTileArray(mapStore.mapId, scene)
placeTiles(props.tileMap, props.tileMapLayer, map.tiles)
})
</script>