forked from noxious/client
asset loading after DL now works
This commit is contained in:
parent
8c7d817bfb
commit
37460a9497
@ -24,6 +24,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import config from '@/config'
|
||||||
import 'phaser'
|
import 'phaser'
|
||||||
import { Game, Scene } from 'phavuer'
|
import { Game, Scene } from 'phavuer'
|
||||||
import World from '@/components/World.vue'
|
import World from '@/components/World.vue'
|
||||||
@ -70,12 +71,13 @@ const preloadScene = (scene: Phaser.Scene) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
socket.connection.emit('assets:download', {}, (response: Asset[]) => {
|
socket.connection.emit('assets:download', {}, (response: Asset[]) => {
|
||||||
|
console.log(response);
|
||||||
response.forEach((asset) => {
|
response.forEach((asset) => {
|
||||||
if (asset.type === 'base64') {
|
if (asset.type === 'base64') {
|
||||||
scene.textures.addBase64(asset.key, asset.value)
|
scene.textures.addBase64(asset.key, asset.value)
|
||||||
}
|
}
|
||||||
if (asset.type === 'link') {
|
if (asset.type === 'link') {
|
||||||
scene.load.image(asset.key, asset.value)
|
scene.load.image(asset.key, config.server_endpoint + '/assets' + asset.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user