1
0
forked from noxious/client

asset loading after DL now works

This commit is contained in:
Dennis Postma 2024-06-30 16:16:24 +02:00
parent 8c7d817bfb
commit 37460a9497

View File

@ -24,6 +24,7 @@
</template>
<script setup lang="ts">
import config from '@/config'
import 'phaser'
import { Game, Scene } from 'phavuer'
import World from '@/components/World.vue'
@ -70,12 +71,13 @@ const preloadScene = (scene: Phaser.Scene) => {
}
socket.connection.emit('assets:download', {}, (response: Asset[]) => {
console.log(response);
response.forEach((asset) => {
if (asset.type === 'base64') {
scene.textures.addBase64(asset.key, asset.value)
}
if (asset.type === 'link') {
scene.load.image(asset.key, asset.value)
scene.load.image(asset.key, config.server_endpoint + '/assets' + asset.value)
}
})
})