This commit is contained in:
2025-01-10 21:03:02 +01:00
parent fb18841c91
commit 4067ec2585
4 changed files with 12 additions and 13 deletions

View File

@ -74,10 +74,9 @@ onMounted(() => {
})
onBeforeUnmount(() => {
if (tileMap) {
tileMap.destroyLayer('tiles')
tileMap.removeAllLayers()
tileMap.destroy()
}
if (!tileMap) return
tileMap.destroyLayer('tiles')
tileMap.removeAllLayers()
tileMap.destroy()
})
</script>

View File

View File

@ -11,7 +11,7 @@ export async function loadTexture(scene: Phaser.Scene, textureData: TextureData)
// Check if the texture is already loaded in Phaser
if (gameStore.game.loadedTextures.find((texture) => texture === textureData.key)) {
return Promise.resolve(true)
return true
}
// If there's already a loading promise for this texture, return it
@ -49,7 +49,7 @@ export async function loadTexture(scene: Phaser.Scene, textureData: TextureData)
}
textureLoadingPromises.delete(textureData.key) // Clean up the promise
return Promise.resolve(false)
return false
})()
// Store the loading promise